Converter ESSE pacote para um executável (.jar)

Olá galera como sou Hyper-Super Novato em java, peço que tenha um pouco de paciencia comigo

é o seguinte eu tenho um pacote , nesse pacote possuem duas classes sendo uma JFrame e outra para armazenar dados e escrever em um .txt

Quero saber como que eu faço para tranformar esse pacote em .jar e como ficaria a situação do .txt

OBS.:Tenho mais preoculpaçao com o .txt onde ele vai ser criado depois de converter para .class

JFRAME >

package CadastroJovens;


import java.awt.BorderLayout;

public class CadastroJovens extends JFrame {

	private JPanel contentPane;
	private JTextField textNome;
	private JTextField textTelefone;
	static String telefone;
	static String nome;
	static String rua;
	static String bairro;
	static String num;
	private JTextField textRua;
	private JTextField textBairro;
	private JTextField textNum;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					CadastroJovens frame = new CadastroJovens();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public CadastroJovens() {
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 450, 300);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
	
		
		JLabel lblNome = new JLabel("Nome");
		lblNome.setBounds(10, 40, 46, 14);
		contentPane.add(lblNome);
		
		textNome = new JTextField();
		textNome.setBounds(75, 36, 152, 23);
		contentPane.add(textNome);
		textNome.setColumns(10);
		
		JLabel lblTelefone = new JLabel("Telefone");
		lblTelefone.setBounds(10, 83, 46, 14);
		contentPane.add(lblTelefone);
		
		textTelefone = new JTextField();
		textTelefone.setBounds(75, 79, 152, 23);
		contentPane.add(textTelefone);
		textTelefone.setColumns(10);
		
		JButton btnNewButton = new JButton("Cadastrar");
		btnNewButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				nome = textNome.getText();
				telefone = textTelefone.getText();
				rua = textRua.getText();
				bairro = textBairro.getText();
				num = textNum.getText();
				Gravação salvando = new Gravação();
				
				try {
					salvando.gravando();
				} catch (IOException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
				JOptionPane.showMessageDialog(null, "Cadastro Efetuado Com suscesso!");
			}
		});
		btnNewButton.setBounds(81, 228, 89, 23);
		contentPane.add(btnNewButton);
		
		JButton btnSair = new JButton("Sair");
		btnSair.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
			System.exit(0);
			}
		});
		btnSair.setBounds(271, 228, 89, 23);
		contentPane.add(btnSair);
		
		JLabel lblRua = new JLabel("Rua");
		lblRua.setBounds(10, 130, 46, 14);
		contentPane.add(lblRua);
		
		textRua = new JTextField();
		textRua.setBounds(75, 127, 152, 20);
		contentPane.add(textRua);
		textRua.setColumns(10);
		
		JLabel lblBairro = new JLabel("Bairro");
		lblBairro.setBounds(10, 168, 46, 14);
		contentPane.add(lblBairro);
		
		textBairro = new JTextField();
		textBairro.setBounds(75, 165, 152, 20);
		contentPane.add(textBairro);
		textBairro.setColumns(10);
		
		JLabel lblN = new JLabel("N\u00BA");
		lblN.setBounds(251, 130, 23, 14);
		contentPane.add(lblN);
		
		textNum = new JTextField();
		textNum.setBounds(284, 127, 86, 20);
		contentPane.add(textNum);
		textNum.setColumns(10);
	}

}

GRAVAÇÃO E LEITURA

package CadastroJovens;
import java.io.*;

import javax.swing.*;
public class Gravação {

	static String Nome;
	static String telefone ;
	static String rua;
	static String bairro;
	static String num;
	

	static void gravando() throws IOException{
		///int descisao=1;
		//int cont=0;
		//int cont1=0;
			
		FileOutputStream fileOutputstream = new FileOutputStream ("teste.txt", true);
		//while (descisao == 1){
			System.getProperty("line.separator");
			fileOutputstream.write("\nNome: ".getBytes());
			//Nome= JOptionPane.showInputDialog("Nome do Jovem:");
			Nome = CadastroJovens.nome;
			fileOutputstream.write(Nome.getBytes());
			System.getProperty("line.separator");
			//-----------
			fileOutputstream.write("\nTelefone: ".getBytes());
			//telefone = JOptionPane.showInputDialog("Telefone do Jovem:");
			telefone = CadastroJovens.telefone;
			fileOutputstream.write(telefone.getBytes());
			System.getProperty("line.separator");
			//------------
			fileOutputstream.write("\nRua: ".getBytes());
			//telefone = JOptionPane.showInputDialog("Telefone do Jovem:");
			rua = CadastroJovens.rua;
			fileOutputstream.write(rua.getBytes());
			//System.getProperty("line.separator");
			
			//--------------------
			fileOutputstream.write("\nNº: ".getBytes());
			//telefone = JOptionPane.showInputDialog("Telefone do Jovem:");
			num = CadastroJovens.num;
			fileOutputstream.write(num.getBytes());
			System.getProperty("line.separator");
			
			//---------------------
			fileOutputstream.write("\nBairro: ".getBytes());
			//telefone = JOptionPane.showInputDialog("Telefone do Jovem:");
			bairro= CadastroJovens.bairro;
			fileOutputstream.write(bairro.getBytes());
			System.getProperty("line.separator");
			fileOutputstream.write("\n------------------------------------------------".getBytes());
			System.getProperty("line.separator");
			
		//String aux = JOptionPane.showInputDialog("Deseja inserir outro jovem ?");
		//descisao = Integer.parseInt(aux);
		//switch (descisao){
		//case 1: descisao =1; break;
		//case 0 : descisao = 0; break;
		//default : JOptionPane.showMessageDialog(null, "Comando Invalido");
		
		//}
		//fileOutputstream.write("\n----Outro texto qualquer".getBytes());
		//}
	
		fileOutputstream.close();
		
		
		FileInputStream fileinputstream = new FileInputStream ("teste.txt");
		
		
		byte nome = (byte) fileinputstream.read();
		byte telefone1 = (byte) fileinputstream.read();
		
		while (nome!=-1 && telefone1 !=-1){
			System.out.println(nome);
			nome= (byte) fileinputstream.read();
			System.out.println(telefone1);
			telefone1= (byte) fileinputstream.read();
		}
		fileinputstream.close();
	}
	
	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
	
		}

}

Obrigado pessoal espero que me ajudem

se for eclipse, use o que o bgomes06 colocou abaixo para exportar

se for netBeans use isto:
clique com o botao direito no projeto, clique em limpar e contruir, espere terminar e pronto !! seu .jar estara criado na pasta dist do seu projeto…

quanto ao seu txt, procure colocar um caminho para ele, ou coloque dentro de um pacote no seu projeto que ele vai ser gerado no .jar

Fala Luhkas!

Então, não consegui fazer o seu programa gerar a saída pro .txt, pelo código ele deve gerar no mesmo local que está sendo executado o programa. Porém mesmo alterando o caminho para C:\teste.txt não consegui a saída.

Mas se puder te ajudar, tente o seguinte pra gerar o .jar

SE sua IDE for Eclipse:

Botão direito no Package Explorer > Export…
Selecione Java > Runnable JAR File.

Launch configuration: procure o seu programa ali
Export Destination: o destino do .jar. Digite o .jar
Library handling:
Não entendo as diferenças, mas sempre usei a primeira opção “Extract required librearies…”

O .jar é gerado!

SE não for Eclipse… boa pergunta, eu desconheço a resposta.

Experimente aí, espero ter ajudado!

Abraço!

cara eu conssegui gerar o .jar vlw galera

só que agora

ele nao quer pular linha ja user o

 ("\n")

e o

System.getProperty("line.separator");

se quiserem eu mando o link do programa para vc6

http://www.4shared.com/file/X6_kelv8/CadastroJovens.html

Só respondendo a minha propria questao,

[code]FileOutputStream NomeQualquer = new FileOutputStream (“NomeDoArq.txt”, true);

NomeQualquer.write(System.getProperty(“line.separator”).getBytes());
[/code]

Vlw galera obrigado e desculpa qualquer coisa!!!