Reputation: 143
I ran into a strange issue.When double click an executable jar it won't open however if I do the following it starts without a problem:
java -jar working_neon.jar
This jar is a swing gui application.The jar file creation is done by eclipse Here is the manifest file:
Manifest-Version: 1.0
Rsrc-Class-Path: ./ miglayout15-swing.jar Message.jar org.apache.commo
ns.io.jar
Class-Path: .
Rsrc-Main-Class: gui.FileCopyManager
Main-Class: org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader
Any ideas?
Upvotes: 0
Views: 851
Reputation: 882
Make sure that you don't use a higher Java-version in Eclipse Project-settings / Run-Configuration than the JRE used to run the jar.
In Eclipse right-click you project -> Properties -> Java-Build-Path -> Libraries.
There you will see the JRE-Version that will be required to run the jar. (Also check the JRE-Version set in Run-Configuration)
Open commandline and type
java -version
Make sure the version displayed there is at least as high, as the one you found in Build-Path and Run-Configuration!
If the version displayed is not as high as the version in build-path either decrease the JRE-version set in Eclipse Build-Path/Run-Configuration or - if not possible - change your PATH-variable to use a higher versioned JRE.
Upvotes: 1
Reputation: 143
Finally managed to fix my problem by selecting Extract required libraries into generated jar
when creating a jar file from eclipse
Upvotes: 0
Reputation: 95
If you are using eclipse: Go to File->Export, under Java folder select 'Runnable JAR file', under Launch configuration select the class where your main method is. Select the export destination, then select Library handling to 'Package required libraries into generated JAR', and click on finish. This works for my swing gui app. I hope it helps
Upvotes: 1