I also get the PENI ('platform encoding not initialized') error because the system has another Java 11 jre in the path. I believe I may know a possible solution if you're not calling the SetDllDirectory function before attempting to load the Java VM DLL.
I can't remove the other JRE from the path so the only workaround I have found so far is to compile my EXE into the jre\bin folder of my bundled JRE using the following JAR2EXE config options:
jre_order c
jvmdll ./server/jvm.dll
That way my EXE runs from the bundled JRE bin so that as the jvm.dll loads, Windows will look in the EXE's directory (which happens to be jre\bin) before it looks in the path for DLLs so all the right DLLs will get loaded and no error. However, I don't want to put my EXE in the jre\bin folder long term.
I have an example project that shows the problem with only a couple lines of Java code and I've written up a more detailed description of what I think may be the solution on your side if you are interested in seeing it.
I also get the PENI ('platform encoding not initialized') error because the system has another Java 11 jre in the path. I believe I may know a possible solution if you're not calling the SetDllDirectory function before attempting to load the Java VM DLL.
I can't remove the other JRE from the path so the only workaround I have found so far is to compile my EXE into the jre\bin folder of my bundled JRE using the following JAR2EXE config options:
jre_order c
jvmdll ./server/jvm.dll
That way my EXE runs from the bundled JRE bin so that as the jvm.dll loads, Windows will look in the EXE's directory (which happens to be jre\bin) before it looks in the path for DLLs so all the right DLLs will get loaded and no error. However, I don't want to put my EXE in the jre\bin folder long term.
I have an example project that shows the problem with only a couple lines of Java code and I've written up a more detailed description of what I think may be the solution on your side if you are interested in seeing it.
Thanks,
Joe