JDK-8259215 : Default Java version is not updated for double click jar execution
  • Type: Bug
  • Component: install
  • Sub-Component: install
  • Affected Version: 8u271
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: windows
  • Submitted: 2021-01-05
  • Updated: 2022-11-02
  • Resolved: 2021-01-12
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Related Reports
CSR :  
Cloners :  
Relates :  
Sub Tasks
JDK-8259861 :  
1- install JDK 15.0.1
2- install JDK 8u271 x64

Default java now set back to 8u271.

Running a Java jar file (java -jar software.jar) or java -version select JDK 8u271 x64 by default (latest installed).
But running a jar file by doing a double click on the desktop or from the file explorer still use JDK 15.0.1, while it should use instead JDK 8u271 x64 (default java).
Note about 2nd step of the test scenario: it is important that JRE get installed together with JDK installer. Alternatively JRE can be installed standalone and not as a part of JDK installation to verify the issue. Test scenario also applies to 32bit JRE8.

Review: https://java.se.oracle.com/code/cru/CR-JDK8UCPU-1208

The problem with the behavior is that prior JDK11 the default java was configured only for JRE, not for JDK. However starting from JDK11 JRE installer was dropped. So in any configuration when JDK8 JRE installer is executed (it can be executed as standalone exe or as a part of JDK installer) if there is newer version of JDK installed, it will be ignored when setting the default java. The problem is very similar to the one described in JDK-8229500. The fix should be alike.