Code Stop working after converting to jar?
I made a simple code that creates a form with a Textbox and a button and an ActionListener
that make a message of the Textbox show when pressing the button. it works on eclipes but when i converting
it to a jar the form open but when i press on the buttn Nothing Happens...
This is my code:
Code :
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
public class hello {
public static void main(String args[]){
final JTextField Textbox = new JTextField(16);
JFrame frame = new JFrame("Java app");
JButton button = new JButton("Send Command");
JPanel panel = new JPanel();
panel.add(button);
panel.add(Textbox);
frame.add(panel);
frame.setSize(500, 400);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
button.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent ae){
JOptionPane.showMessageDialog(null, Textbox.getText());
}
});
}
}
how can i fix it?
Re: Code Stop working after converting to jar?
Quote:
when i press on the buttn Nothing Happens
Are there any error messages? Please copy and paste them here.
To see the error messages, open a command prompt window, go to the folder with the jar file and enter:
java -jar YOURJARFILENAME.jar
Then copy the contents of command prompt window:
To copy the contents of the command prompt window:
Click on Icon in upper left corner
Select Edit
Select 'Select All' - The selection will show
Click in upper left again
Select Edit and click 'Copy'
Paste here.
Re: Code Stop working after converting to jar?
Thank you very very much [: i found the Problem it was Because I did not put the second part of the class when i created the jar...