0

Ok, hello everyone. In eclipse I choose a JDialog from windowBuilder then with just the standard code provided I right click the file and export, I click jar file, I "Export generated class files and resources" and save to desktop. Now I have a box on my desktop, I extract the class file and then I am stuck. Am I wrong to think it should be like windows.?..Thank you.

  • What are you trying to do? Your jar will run if you doubleclick it if you have the .jar type associated with java.exe, or you can run it from the command line with java -jar yourjarfile.jar. Are you sure your app is runnable? Does it have a public static void main() ? – Kevin Hooke Mar 27 '18 at 16:56

2 Answers2

0

If you're trying to run it from the Gnome desktop by double-clicking it, then the steps in this article might be what you're looking for: https://nguyenvinhlinh.wordpress.com/2014/02/05/launching-executable-jar-file-by-a-double-click-in-fedora/

Kevin Hooke
  • 2,583
  • 2
  • 19
  • 33
  • This is the error I get when I try to run the jar file from the terminal -> "no main manifest attribute, in Jammer.jar" using "java -jar /path/to/yourjarfile.jar". It also has the "public static void main()". I am basically trying to make a simple gui that will work when i click it with no need for eclipse or terminal. I have a package and extracted class file on my desktop. – Michael Vargas Mar 28 '18 at 15:06
  • This sounds like you're missing a MANIFEST.MF specifying name of your Main-Class. See here: https://stackoverflow.com/questions/5258159/how-to-make-an-executable-jar-file – Kevin Hooke Mar 28 '18 at 16:32
  • Thank for the helpful direction but now I have a new issue, when I run "java -jar /path/to/yourjarfile.jar" I get this error "Could not find or load main class package.MainClass". I have the jar file package, the class file and MF file all in one folder. The MF and class file have both been extracted. Also when I run "jar cfm Jammer.jar MANIFEST.MF Jammer.class" I recieve no errors. – Michael Vargas Mar 30 '18 at 15:51
  • Does the value of Main-Class in your MANIFEST.MF point to the name of your class with the main() method you want to execute? – Kevin Hooke May 16 '18 at 00:37
0

If i were you I will try on the terminal:

java -jar /path/to/yourjarfile.jar

If that file has any problem it will be shown on the terminal and maybe you find the error why is not running.