Reputation: 4187
I try to compress my javafx app into jar, and when i run:
java -jar /home/roroco/Dropbox/rbs/ro_cmds_global/j/fileToClip/build/libs/server-1.0.jar -cp /home/roroco/Downloads/jdk1.8.0_74/jre/lib/ext/jfxrt.jar
it raise this error:
Caused by: java.lang.ClassNotFoundException: javafx.application.Application
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
I'm sure jfxrt.jar include javafx.application.Application
roroco@roroco /tmp/fileToClip $ jar tf
/home/roroco/Downloads/jdk1.8.0_74/jre/lib/ext/jfxrt.jar|gr Application\.class
com/sun/glass/ui/Application.class
com/sun/glass/ui/gtk/GtkApplication.class
javafx/application/Application.class
why it will raise "ClassNotFoundException"?
update
my java version is:
roroco@roroco ~/Dropbox/try/j/try $ java -version
openjdk version "1.8.0_91"
OpenJDK Runtime Environment (build 1.8.0_91-8u91-b14-0ubuntu4~14.04-b14)
OpenJDK 64-Bit Server VM (build 25.91-b14, mixed mode)
Upvotes: 1
Views: 7665
Reputation: 93
The problem is probably de java version in your IDE is not the same that the java version of your linux when you "java" comamnd.
Upvotes: 0
Reputation: 4187
I find the reason: since my java version is:
roroco@roroco ~/Dropbox/try/j/try $ java -version
openjdk version "1.8.0_91"
OpenJDK Runtime Environment (build 1.8.0_91-8u91-b14-0ubuntu4~14.04-b14)
OpenJDK 64-Bit Server VM (build 25.91-b14, mixed mode)
i should use oracle bin/java instead, in my case, I use following will work:
/home/roroco/Downloads/jdk1.8.0_74/bin/java -jar /home/roroco/Dropbox/rbs/ro_cmds_global/j/fileToClip/build/libs/server-1.0.jar
Upvotes: 2