Opened 6 years ago
Last modified 5 years ago
#18809 closed defect
JOSM uses unexpected java version — at Initial Version
| Reported by: | Owned by: | team | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Installer Windows | Version: | |
| Keywords: | Cc: | stoecker |
Description
Originally encountered while debugging https://josm.openstreetmap.de/ticket/18769
Summary:
With some system configurations, josm.exe (with launch4j) uses java 8, josm-tested.jar uses java 13
My experience:
I updated JOSM to latest, installed OpenJDK 13 and changed the %JAVA_HOME% environment variable to point to it.
When I opened a console and ran
java -version
I get
OpenJdk version "13.0.2" 2020-01-14
When I ran
C:\Program Files (x86)\JOSM\josm-tested.jar
The program is visually improved in many ways (layout, font etc)
In Help -> About -> Info
Java Version is 13
In Help -> About -> Installation Details
%JAVA_HOME% points to OpenJDK 13
<java.home> points to OpenJDK 13
When I ran
C:\Program Files (x86)\JOSM\josm.exe
The program is visually poor in many ways
In Help -> About -> Info
Java Version is 8
In Help -> About -> Installation Details
%JAVA_HOME% points to OpenJDK 13
<java.home> points to java 8
Situation which created the problem:
- I had installed java 8 JRE previously.
- I had downloaded the OpenJDK 13 JDK, but josm.exe is configured to prefer a JRE
- I had correctly set the JAVA_HOME environment variable, but launch4j ignores JAVA_HOME and only looks at registry keys. This might change with the next release of launch4j.
- While installing OpenJDK, I did not write java keys to registry
To work around the problem:
- Download the OpenJDK 13 JRE (NOT JDK)
- Select the installer option to write registry keys
I suggest two changes to launch4j.xml to avoid this problem:
- <jdkPreference>preferJre</jdkPreference>
- should be: <jdkPreference>preferJdk</jdkPreference>
- Will take a JDK over a JRE
- <path></path>
- should be: <path>%JAVA_HOME%</path>
- Will negate the need to have registry keys, which are not always there for OpenJDK
I am not well versed in java, launch4j, registry keys, or the JAVA_HOME environment variable. I have not tested my suggested changes and I don't know if it might break it for other people. Also, just waiting for the next release of launch4j might fix this.


