简体   繁体   中英

Export runnable JAR file

I try to export a Java-Project with different Libraries included a JavaFX GUI and lots of different stuff to a runnable JAR file. When i run my project in eclipse there is no problem. But when I try to export it to a runnable JAR file and afterwards i try to start is it never opens a window there is just a process running in the background.

I don't know how to describe my problem better. But maybe you can help me with this information already.

(using eclipse)

Exporting a jar for a javafx project in eclipse, has always ended up with some problem or the other for me. May be, though I am not sure, eclipse packages the jar as per Swing configurations, where as Javafx needs some peculiar configuration. For details visit

http://docs.oracle.com/javafx/2/deployment/packaging.htm

For an easier method, you can always port your project to NetBeans and use the jar that is created by it ! The jar created by Netbeans works flawlessly for me !

You should be using the option "Export Runnable JAR File" and "Extract required libraries into generated JAR".

Try also adding the jfxrt.jar to the Java Build Path when not using Java 8.

The probable issue is like the dependent Jars are not in place. Are you providing any VM arguments to run your Application from Eclipse.

If Yes, then please note you can't provide VM arguments in the Runnable Jar.

Solution is , you can use "Launch4J" to pass VM arguments to your application.

" VM arguments will not be part of the runnable JAR. Arguments can be passed on the command line when launching the JAR ".

While creating the Runnable Jar, check first checkbox "Extract Required Libraries into generated JAR".

Cheers .. :)

Subh

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM