To configure the JRE Find Order
Introduction
Generated exe files can find JRE on host by many ways. 'jre_order' is to configure how generated exe finds JRE.
The default value of jre_order is "cbsie", each letter stands for a way to find JRE:
- c - Configured JRE by 'jvmdll'
- b - Bundled JRE which is configured by 'jre'
- s - Installed SUN JRE (Windows) / or 'java' symbol link (Linux)
- i - Installed IBM JRE (Windows)
- e - Environment JAVA_HOME or JRE_HOME
Change Find Order
You can change the find order by change the letter sequence.
For example:
jre_order ecbsi
is to tell generated exe to find JRE from environment JAVA_HOME first.
Disable One of Them
If one of the letters is missing, the corresponding way to find JRE is disabled.
For example:
jre_order s
is to tell generated exe to find from registry / or 'java' symbol link only, ignoring JAVA_HOME and jvmdll.
If none of the letters exists, generated exe will use the default "cbsie".
See Also
- See jvmdll for details of specifying JRE in configuration file.
- See Find JRE Itself page for details of how generated exe finds JRE.
Comments
I also have the PENI error
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
It conflict with the version already installed.
I have a java version installed and i put jre alongslide my exe and specify it in the config file. Im getting this error.
'platform encoding not initialized',
If i remove the java version from classpath it resolve the issue.
Windows Store requires latest Java to be installed
It has been discovered that if the Java runtime is not up to date, the exe generated by Jar2Exe might emit the "invalid Java runtime" error. So if this error is encountered, the first thing to try would be to install the latest version of Java on the machine in question.
msix Package for Windows Store
When the executive from Jar2Exe is installed on Windows 10 directly, everything works fine, as expected.
When the same executive is packaged for the "Microsoft Store" (msix package), installs show the message "invalid Java runtime", and the program does not run.
Using Jar2Exe 2.2 Personal Base, licenced.
Are there any suggestions for changes to the build such that this error can be avoided?
Add new comment