Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Code Stop working after converting to jar?

  1. #1
    Junior Member
    Join Date
    Aug 2010
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default 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:
    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?


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Code Stop working after converting to jar?

    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.

  3. The Following User Says Thank You to Norm For This Useful Post:

    Ron6566 (August 16th, 2010)

  4. #3
    Junior Member
    Join Date
    Aug 2010
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default 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...

Similar Threads

  1. Replies: 4
    Last Post: April 27th, 2010, 01:18 AM
  2. radio buttons stop working
    By tabutcher in forum AWT / Java Swing
    Replies: 2
    Last Post: March 5th, 2010, 09:28 AM
  3. Replies: 4
    Last Post: May 1st, 2009, 03:32 PM
  4. Replies: 4
    Last Post: January 27th, 2009, 12:03 AM
  5. Java program to find the minimum and maximum values of input data
    By awake77 in forum What's Wrong With My Code?
    Replies: 6
    Last Post: December 20th, 2008, 05:12 PM