I have exported my java project into a jar in my desktop (chose the option that creates a project.jar and a project_lib).
When I run java -jar project.jar
on cmd, I get this exception:
Exception in thread "main" java.lang.RuntimeException: Application launch error
at com.sun.javafx.application.LauncherImpl$1.run(LauncherImpl.java:122)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.UnsatisfiedLinkError: com.sun.glass.ui.win.WinApplication._invokeLater(Ljava/lang/Runnable;)V
at com.sun.glass.ui.win.WinApplication._invokeLater(Native Method)
at com.sun.glass.ui.Application.invokeLater(Application.java:338)
at com.sun.javafx.tk.quantum.QuantumToolkit.defer(QuantumToolkit.java:620)
at com.sun.javafx.application.PlatformImpl.runLater(PlatformImpl.java:173)
at com.sun.javafx.application.PlatformImpl.runAndWait(PlatformImpl.java:212)
at com.sun.javafx.application.PlatformImpl.tkExit(PlatformImpl.java:320)
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:421)
at com.sun.javafx.application.LauncherImpl.access$000(LauncherImpl.java:47)
at com.sun.javafx.application.LauncherImpl$1.run(LauncherImpl.java:115)
... 1 more
I guess it is probably caused by my project's paths but I don't know how to fix this.
EDIT: It works fine in eclipse and in my /Desktop directory. Everywhere else, this exception is thrown.
EDIT2: This is the MANIFEST.MF file built:
Manifest-Version: 1.0
Class-Path: . wfmgr_lib/jfxrt.jar wfmgr_lib/junit.jar wfmgr_lib/org.ha
mcrest.core_1.3.0.v201303031735.jar wfmgr_lib/gson-2.3.1.jar
Main-Class: main.screens.ScreenFramework
EDIT3: I have both jdk 7 and 8 installed. I set up my eclipse project so its compliance level is java-7, building compatible code for the latter.
I also tried using launcher4J and it only worked (in any directory) with the following configurations:
launch4J.log:
Version: 3.8
CmdLine: C:\Users\a51217\Desktop\wfmgr_final\wfmgrexe.exe --l4j-debug
WOW64: yes
Working dir: C:\Users\a51217\Desktop\wfmgr_final\.
Bundled JRE: C:\Program Files\Java\jre7
Check launcher: C:\Program Files\Java\jre7\bin\javaw.exe (OK)
Substitute: PATH = C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\AXALTO\Access Client\v5\;C:\Program Files (x86)\AXALTO\Access Client\v5\;C:\Program Files (x86)\Common Files\Check Point\UIFramework 3.0\Bin\;C:\Program Files (x86)\CheckPoint\Endpoint Security\Endpoint Common\bin;C:\Users\a51217\Downloads\jdk-8u51\bin;C:\Users\a51217\Downloads\mysql-5.6.25-winx64\mysql-5.6.25-winx64/bin;C:\Users\a51217\Downloads\apache-tomcat-8.0.24\apache-tomcat-8.0.24\bin;C:\Users\a51217\Downloads\apache-maven-3.3.3-bin\apache-maven-3.3.3\bin;C:\Program Files\Java\jre7\bin;C:\Program Files\Java\jre7\bin
Substitute: JAVA_HOME = C:\Users\a51217\Downloads\jdk-8u51
Substitute: C:\Program Files\Java\jre7\lib\jfxrt.jar =
Add classpath: .
Add classpath: wfmgr_lib\jfxrt.jar
Add classpath: wfmgr_lib\junit.jar
Add classpath: wfmgr_lib\org.hamcrest.core_1.3.0.v201303031735.jar
Add classpath: C:\Program Files\Java\jre7\lib
Add classpath: C:\Program Files\Java\jre7\bin
Launcher: C:\Program Files\Java\jre7\bin\javaw.exe
Launcher args: -Denv.path="C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\AXALTO\Access Client\v5\;C:\Program Files (x86)\AXALTO\Access Client\v5\;C:\Program Files (x86)\Common Files\Check Point\UIFramework 3.0\Bin\;C:\Program Files (x86)\CheckPoint\Endpoint Security\Endpoint Common\bin;C:\Users\a51217\Downloads\jdk-8u51\bin;C:\Users\a51217\Downloads\mysql-5.6.25-winx64\mysql-5.6.25-winx64/bin;C:\Users\a51217\Downloads\apache-tomcat-8.0.24\apache-tomcat-8.0.24\bin;C:\Users\a51217\Downloads\apache-maven-3.3.3-bin\apache-maven-3.3.3\bin;C:\Program Files\Java\jre7\bin;C:\Program Files\Java\jre7\bin" -Denv.java.home="C:\Users\a51217\Downloads\jdk-8u51" -Denv.c:\program.files\java\jre7\lib\jfxrt.jar="" -classpath "C:\Users\a51217\Desktop\wfmgr_final\wfmgrexe.exe;.;wfmgr_lib\jfxrt.jar;wfmgr_lib\junit.jar;wfmgr_lib\org.hamcrest.core_1.3.0.v201303031735.jar;C:\Program Files\Java\jre7\lib;C:\Program Files\Java\jre7\bin" main.screens.ScreenFramework
Args length: 1008/32768 chars
Exit code: 0
Version: 3.8
CmdLine: C:\Users\a51217\Desktop\wfmgr_final\wfmgrexe.exe --l4j-debug
WOW64: yes
Working dir: C:\Users\a51217\Desktop\wfmgr_final\.
Bundled JRE: C:\Program Files\Java\jre7
Check launcher: C:\Program Files\Java\jre7\bin\javaw.exe (OK)
Substitute: PATH = C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\AXALTO\Access Client\v5\;C:\Program Files (x86)\AXALTO\Access Client\v5\;C:\Program Files (x86)\Common Files\Check Point\UIFramework 3.0\Bin\;C:\Program Files (x86)\CheckPoint\Endpoint Security\Endpoint Common\bin;C:\Users\a51217\Downloads\jdk-8u51\bin;C:\Users\a51217\Downloads\mysql-5.6.25-winx64\mysql-5.6.25-winx64/bin;C:\Users\a51217\Downloads\apache-tomcat-8.0.24\apache-tomcat-8.0.24\bin;C:\Users\a51217\Downloads\apache-maven-3.3.3-bin\apache-maven-3.3.3\bin;C:\Program Files\Java\jre7\bin;C:\Program Files\Java\jre7\bin
Substitute: JAVA_HOME = C:\Users\a51217\Downloads\jdk-8u51
Substitute: C:\Program Files\Java\jre7\lib\jfxrt.jar =
Add classpath: .
Add classpath: wfmgr_lib\jfxrt.jar
Add classpath: wfmgr_lib\junit.jar
Add classpath: wfmgr_lib\org.hamcrest.core_1.3.0.v201303031735.jar
Add classpath: C:\Program Files\Java\jre7\lib
Add classpath: C:\Program Files\Java\jre7\bin
Launcher: C:\Program Files\Java\jre7\bin\javaw.exe
Launcher args: -Denv.path="C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\AXALTO\Access Client\v5\;C:\Program Files (x86)\AXALTO\Access Client\v5\;C:\Program Files (x86)\Common Files\Check Point\UIFramework 3.0\Bin\;C:\Program Files (x86)\CheckPoint\Endpoint Security\Endpoint Common\bin;C:\Users\a51217\Downloads\jdk-8u51\bin;C:\Users\a51217\Downloads\mysql-5.6.25-winx64\mysql-5.6.25-winx64/bin;C:\Users\a51217\Downloads\apache-tomcat-8.0.24\apache-tomcat-8.0.24\bin;C:\Users\a51217\Downloads\apache-maven-3.3.3-bin\apache-maven-3.3.3\bin;C:\Program Files\Java\jre7\bin;C:\Program Files\Java\jre7\bin" -Denv.java.home="C:\Users\a51217\Downloads\jdk-8u51" -Denv.c:\program.files\java\jre7\lib\jfxrt.jar="" -classpath "C:\Users\a51217\Desktop\wfmgr_final\wfmgrexe.exe;.;wfmgr_lib\jfxrt.jar;wfmgr_lib\junit.jar;wfmgr_lib\org.hamcrest.core_1.3.0.v201303031735.jar;C:\Program Files\Java\jre7\lib;C:\Program Files\Java\jre7\bin" main.screens.ScreenFramework
Args length: 1008/32768 chars
Exit code: 0
Version: 3.8
CmdLine: C:\Users\a51217\Desktop\wfmgr_final\wfmgrexe.exe --l4j-debug
WOW64: yes
Working dir: C:\Users\a51217\Desktop\wfmgr_final\.
Bundled JRE: C:\Program Files\Java\jre7
Check launcher: C:\Program Files\Java\jre7\bin\javaw.exe (OK)
Substitute: PATH = C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\AXALTO\Access Client\v5\;C:\Program Files (x86)\AXALTO\Access Client\v5\;C:\Program Files (x86)\Common Files\Check Point\UIFramework 3.0\Bin\;C:\Program Files (x86)\CheckPoint\Endpoint Security\Endpoint Common\bin;C:\Users\a51217\Downloads\jdk-8u51\bin;C:\Users\a51217\Downloads\mysql-5.6.25-winx64\mysql-5.6.25-winx64/bin;C:\Users\a51217\Downloads\apache-tomcat-8.0.24\apache-tomcat-8.0.24\bin;C:\Users\a51217\Downloads\apache-maven-3.3.3-bin\apache-maven-3.3.3\bin;C:\Program Files\Java\jre7\bin;C:\Program Files\Java\jre7\bin
Substitute: JAVA_HOME = C:\Users\a51217\Downloads\jdk-8u51
Substitute: C:\Program Files\Java\jre7\lib\jfxrt.jar =
Add classpath: .
Add classpath: wfmgr_lib\jfxrt.jar
Add classpath: wfmgr_lib\junit.jar
Add classpath: wfmgr_lib\org.hamcrest.core_1.3.0.v201303031735.jar
Add classpath: C:\Program Files\Java\jre7\lib
Add classpath: C:\Program Files\Java\jre7\bin
Add classpath: C:\Program Files\Java\jre7\lib\jfxrt.jar
Launcher: C:\Program Files\Java\jre7\bin\javaw.exe
Launcher args: -Denv.path="C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\AXALTO\Access Client\v5\;C:\Program Files (x86)\AXALTO\Access Client\v5\;C:\Program Files (x86)\Common Files\Check Point\UIFramework 3.0\Bin\;C:\Program Files (x86)\CheckPoint\Endpoint Security\Endpoint Common\bin;C:\Users\a51217\Downloads\jdk-8u51\bin;C:\Users\a51217\Downloads\mysql-5.6.25-winx64\mysql-5.6.25-winx64/bin;C:\Users\a51217\Downloads\apache-tomcat-8.0.24\apache-tomcat-8.0.24\bin;C:\Users\a51217\Downloads\apache-maven-3.3.3-bin\apache-maven-3.3.3\bin;C:\Program Files\Java\jre7\bin;C:\Program Files\Java\jre7\bin" -Denv.java.home="C:\Users\a51217\Downloads\jdk-8u51" -Denv.c:\program.files\java\jre7\lib\jfxrt.jar="" -classpath "C:\Users\a51217\Desktop\wfmgr_final\wfmgrexe.exe;.;wfmgr_lib\jfxrt.jar;wfmgr_lib\junit.jar;wfmgr_lib\org.hamcrest.core_1.3.0.v201303031735.jar;C:\Program Files\Java\jre7\lib;C:\Program Files\Java\jre7\bin;C:\Program Files\Java\jre7\lib\jfxrt.jar" main.screens.ScreenFramework
Args length: 1049/32768 chars
Exit code: 0
image4j.xml
<?xml version="1.0" encoding="UTF-8"?>
-<launch4jConfig> <dontWrapJar>false</dontWrapJar> <headerType>gui</headerType> <jar>C:\Users\a51217\Desktop\wfmgr.jar</jar> <outfile>C:\Users\a51217\Desktop\wfmgr_final\wfmgrexe.exe</outfile> <errTitle/> <cmdLine/> <chdir>.</chdir> <priority>normal</priority> <downloadUrl>http://ift.tt/KJJukw; <supportUrl/> <stayAlive>false</stayAlive> <restartOnCrash>false</restartOnCrash> <manifest/> <icon/> -<classPath> <mainClass>main.screens.ScreenFramework</mainClass> <cp>.</cp> <cp>wfmgr_lib/jfxrt.jar</cp> <cp>wfmgr_lib/junit.jar</cp> <cp>wfmgr_lib/org.hamcrest.core_1.3.0.v201303031735.jar</cp> <cp>C:\Program Files\Java\jre7\lib</cp> <cp>C:\Program Files\Java\jre7\bin</cp> <cp>C:\Program Files\Java\jre7\lib\jfxrt.jar</cp> </classPath> -<jre> <path>C:\Program Files\Java\jre7</path> <bundledJre64Bit>true</bundledJre64Bit> <bundledJreAsFallback>false</bundledJreAsFallback> <minVersion>1.6.0</minVersion> <maxVersion>1.9.0</maxVersion> <jdkPreference>preferJre</jdkPreference> <runtimeBits>64/32</runtimeBits> <opt>-Denv.path="%PATH%"</opt> <opt>-Denv.java.home="%JAVA_HOME%"</opt> <opt>-Denv.c:\program.files\java\jre7\lib\jfxrt.jar="%C:\Program Files\Java\jre7\lib\jfxrt.jar%"</opt> </jre> -<messages> <startupErr>An error occurred while starting the application.</startupErr> <bundledJreErr>This application was configured to use a bundled Java Runtime Environment but the runtime is missing or corrupted.</bundledJreErr> <jreVersionErr>This application requires a Java Runtime Environment</jreVersionErr> <launcherErr>The registry refers to a nonexistent Java Runtime Environment installation or the runtime is corrupted.</launcherErr> <instanceAlreadyExistsMsg>An application instance is already running.</instanceAlreadyExistsMsg> </messages> </launch4jConfig>
via
Chebli Mohamed