ADDITIONAL SYSTEM INFORMATION :
OS: Windows10 1607 (internal version 14393.2430)
Java: 12.0.1, extracted from the official release package jdk-12.0.1_windows-x64_bin.zip.
A DESCRIPTION OF THE PROBLEM :
Try to launch the JVM on windows10, with command line "java -version"; and it failed due to NullPointerException on java.base/java.lang.System.props, with the following stacks:
Error occurred during initialization of VM
java.lang.NullPointerException
at java.lang.System.getProperty(java.base/System.java:848)
at sun.security.action.GetPropertyAction.privilegedGetProperty(java.base/GetPropertyAction.java:105)
at java.nio.charset.Charset.defaultCharset(java.base/Charset.java:607)
at java.lang.StringCoding.decode(java.base/StringCoding.java:316)
at java.lang.String.<init>(java.base/String.java:601)
at java.lang.String.<init>(java.base/String.java:623)
at jdk.internal.util.SystemProps$Raw.vmProperties(java.base/Native Method)
at jdk.internal.util.SystemProps$Raw.cmdProperties(java.base/SystemProps.java:261)
at jdk.internal.util.SystemProps.initProperties(java.base/SystemProps.java:55)
at java.lang.System.initPhase1(java.base/System.java:1997)
I've checked the source of System.java. It seems that the implementation is not accordant with the following comments:
/**
* Initialize the system class. Called after thread initialization.
*/
private static void initPhase1() {
// VM might invoke JNU_NewStringPlatform() to set those encoding
// sensitive properties (user.home, user.name, boot.class.path, etc.)
// during "props" initialization.
// The charset is initialized in System.c and does not depend on the Properties.
Map<String, String> tempProps = SystemProps.initProperties();
VersionProps.init(tempProps);
// There are certain system configurations that may be controlled by
// VM options such as the maximum amount of direct memory and
// Integer cache size used to support the object identity semantics
// of autoboxing. Typically, the library will obtain these values
// from the properties set by the VM. If the properties are for
// internal implementation use only, these properties should be
// masked from the system properties.
//
// Save a private copy of the system properties object that
// can only be accessed by the internal implementation.
VM.saveProperties(tempProps);
props = createProperties(tempProps);
........
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
executing cmd: java -version
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
JVM launched, and show the correct version info.
ACTUAL -
NullPointException occured.
FREQUENCY : always