I'm trying to generate the Windows bundle of my JavaFX application using JPackage. I'm running on Liberica JDK 19 and my scripts first generate a runtime using JLink with a --vm=client
argument and then they run jpackage with a --runtime-image
pointing to the generated image.
Everything runs fine when I launch the application generated by jpackage using a .bat script, but when I run the the generated .exe I get an error and, looking at the debug information, it seems the .exe is loading the jvm.dll from the runtime\bin\server
instaed of the runtime\bin\client
folder:
[TRACE] app.cpp:123: Entering app::launch
[TRACE] AppLauncher.cpp:116: Launcher config file path: "C:\delete\pdfsam-5.0.0-SNAPSHOT-windows\pdfsam\app\pdfsam.cfg"
[TRACE] JvmLauncher.cpp:44: Jvm(000001319907E960)::Jvm()
[TRACE] AppLauncher.cpp:76: Property "app.runtime" not found in "Application" section of launcher config file. Using Java runtime from "C:\delete\pdfsam-5.0.0-SNAPSHOT-windows\pdfsam\runtime" directory
[TRACE] JvmLauncher.cpp:49: Jvm(000001319907E960)::~Jvm()
[TRACE] app.cpp:123: Entering app::launch
[TRACE] AppLauncher.cpp:116: Launcher config file path: "C:\delete\pdfsam-5.0.0-SNAPSHOT-windows\pdfsam\app\pdfsam.cfg"
[TRACE] JvmLauncher.cpp:44: Jvm(00000200C91AE310)::Jvm()
[TRACE] AppLauncher.cpp:76: Property "app.runtime" not found in "Application" section of launcher config file. Using Java runtime from "C:\delete\pdfsam-5.0.0-SNAPSHOT-windows\pdfsam\runtime" directory
[TRACE] WinLauncher.cpp:216: SetDllDirectory to: C:\delete\pdfsam-5.0.0-SNAPSHOT-windows\pdfsam\runtime\bin
[TRACE] WinLauncher.cpp:73: Entering `anonymous-namespace'::loadDllWithAddDllDirectory
[TRACE] WinLauncher.cpp:89: AddDllDirectory(C:\delete\pdfsam-5.0.0-SNAPSHOT-windows\pdfsam\runtime\bin): OK
[TRACE] WinLauncher.cpp:97: LoadLibraryEx(C:\delete\pdfsam-5.0.0-SNAPSHOT-windows\pdfsam\runtime\bin\jli.dll, LOAD_LIBRARY_SEARCH_DEFAULT_DIRS): 00007FFCCB100000
[TRACE] WinLauncher.cpp:0: Exiting `anonymous-namespace'::loadDllWithAddDllDirectory (entered at WinLauncher.cpp:73)
[TRACE] WinLauncher.cpp:73: Entering `anonymous-namespace'::loadDllWithAddDllDirectory
[TRACE] WinLauncher.cpp:0: Exiting `anonymous-namespace'::loadDllWithAddDllDirectory (entered at WinLauncher.cpp:73)
[TRACE] WinLauncher.cpp:52: Entering `anonymous-namespace'::loadDllWithAlteredPATH
[TRACE] WinLauncher.cpp:62: New value of PATH: SOME PATH HERE;C:\delete\pdfsam-5.0.0-SNAPSHOT-windows\pdfsam\app;C:\delete\pdfsam-5.0.0-SNAPSHOT-windows\pdfsam\runtime\bin\server
[TRACE] WinLauncher.cpp:0: Exiting `anonymous-namespace'::loadDllWithAlteredPATH (entered at WinLauncher.cpp:52)
[TRACE] JvmLauncher.cpp:49: Jvm(00000200C91AE310)::~Jvm()
[ERROR] app.cpp:179: Exception with message 'WinDll.cpp(40) at `anonymous-namespace'::loadLibrary(): LoadLibraryW(C:\delete\pdfsam-5.0.0-SNAPSHOT-windows\pdfsam\runtime\bin\server\jvm.dll) failed. System error [126](system error 126 (Impossibile trovare il modulo specificato))' caught
LoadLibraryW(C:\delete\pdfsam-5.0.0-SNAPSHOT-windows\pdfsam\runtime\bin\server\jvm.dll) failed. System error [126](system error 126 (Impossibile trovare il modulo specificato))
[TRACE] app.cpp:0: Exiting app::launch (entered at app.cpp:123)
Any idea what I might be doing wrong?
CodePudding user response:
Don't use the jlink
option:
--vm=client
At least for Oracle JDK, and probably for other JDK distributions as well, the client VM is no longer part of the distribution:
In Oracle Java Runtime Environment (JRE) 8 and earlier, different implementations of the JVM, (the client VM, server VM, and minimal VM), were supported for configurations commonly used as clients, servers, and for embedded systems. As most systems can now take advantage of the server VM, the Oracle Java Runtime Environment (JRE) 9 provides only that VM implementation.
The jlink
documentation states:
Plug-ins not listed in this section aren't supported and are subject to change.
The vm
plugin isn't listed in the documentation, so it really should not be used.