Kiril
Kiril

Reputation: 272

difficulty with .jar file

I am trying to create an executable .jar file. I create it and when I run it it is giving me the following error ==>

Failed to load Main-Class manifest atribute from C:\Users\Anastasov\Desktop\test.jar

where C:\Users\Anastasov\Desktop\test.jar is the directory of my .jar file and the name of the jar file is test.jar. I am following this tutorial by the way http://www.youtube.com/watch?v=hwVuK0X-0P0

Here are the steps of what I have done: ==> so I first compile my class than I create myManifest.txt and specify where the main class is and it is in the Jdialogs.java and finaly i write in cmd:

jar cfm  test.jar myManifest.txt Jdialogs.class

Then the test.jar is created and is giving me the error from the top. If anyone is familiar with it and can help It would be appreciated Cheers.
Here is my Jdialogs.java code

   //Jdialogs.java
    //19.02.12

    import javax.swing.JOptionPane;
    class Jdialogs
    {
      public static void main(String[] args)
      {
       // JOptionPane.showMessageDialog(null, message, titile is a string, messageType can be error info warning...);
          int answer;
          do
          {
          answer = JOptionPane.showConfirmDialog(null, "Can you see this dialog ?");

        // do something with the asnwer
        JOptionPane.showMessageDialog(null, "The confirm returned=" + answer,
         "Confirm Value", JOptionPane.INFORMATION_MESSAGE );

        answer = JOptionPane.showConfirmDialog(null, "Rerun dmeo?", "Confirm Demo", JOptionPane.YES_NO_OPTION);
        System.out.println("Debug: Rerun Demo - Answer: " + answer);

          }while (answer == JOptionPane.YES_OPTION);

      }
    }

Upvotes: 1

Views: 449

Answers (1)

user unknown
user unknown

Reputation: 36269

 jar cfe test.jar Jdialogs Jdialogs.class 

Should create the right -e entry point.

Upvotes: 1

Related Questions