0

I'm trying to build executable jar file. I'm fairly new to this and not really sure how it is suppose to work. I'm using eclipse 64 bit and windows 7. I'm exporting the project to jar file. This is project code. when I double click the file it doesn't do anything and I'm expecting to see a message box. Can you please tell me what am I doing wrong and help me fix it. thanks.

import javax.swing.*;
public class Starter {
public static void main(String[] args) 
{
  String st="Welcome";
  JOptionPane.showMessageDialog(null,st);
}
}
Pavel
  • 15
  • 1
  • 1
  • 3
  • Does it work when you execute from command line (using java, NOT javaw)? If yes, do you have .jar file association setup correctly? If no, what's the error message? – LeleDumbo Aug 05 '12 at 21:15
  • This looks like a duplicate question of http://stackoverflow.com/questions/394616/running-jar-file-in-windows – pho Aug 05 '12 at 21:22
  • `java -jar your-exported-jar-file.jar` – Matt Aug 05 '12 at 21:25
  • yeah, the error im getting is no main manifest attribute in my jar file – Pavel Aug 05 '12 at 21:31

1 Answers1

0

It sounds as if there is no Main-Class defined in the MANIFEST.MF in your jar file.

There are numerous guides on how to create an executable jar available such as this one.

Reimeus
  • 158,255
  • 15
  • 216
  • 276