Add new comment

problem with the same version of Java in PATH env variable

In Windows, in the PATH I have the path of this version of Java: C:\Program Files\Java\jdk-17.0.2\bin in order to be able to execute the java command to run jar files.

I created an exe file with jar2exe using the jre locally in the exe folder, and that jre is the jre-17.0.2

When I run the exe file in console version it shows this error:

Exception in thread "JavaFX Application Thread" java.lang.InternalError: platform encoding not initialized
        at java.base/java.net.Inet6AddressImpl.getLocalHostName(Native Method)
        at java.base/java.net.InetAddress.getLocalHost(InetAddress.java:1628)
        at org.apache.logging.log4j.core.util.NetUtils.getLocalHostname(NetUtils.java:54)

that comes from log4j library

the case is that when I change in the PATH env variable from C:\Program Files\Java\jdk-17.0.2\bin to another version of java: C:\Program Files (x86)\Java\jdk-16.0.1\bin

if I execute the exe file there is no problem

Is there any way to fix this?

part of the config to generate the exe file is this:

/type console /minjre "1.8" /platform windows /checksum:false /amd64 /config "jre_order c" /config "forcecwd ." /config "jvmdll jre\bin\server\jvm.dll" /config "option -Xmx1024m"

can I add some config to handle this error when the PATH env variable has the path to the same Java version in another folder?