Search code examples
javavirtual-machinejava-14

jdk-14.0.1 Error occurred during initialization of VM java.lang.NullPointerException


I installed jdk-14.0.1 in my computer and I set Environment variable for that, when I give command java or java -version it gives below exception.

Error occurred during initialization of VM
java.lang.NullPointerException
        at java.lang.System.getProperty(java.base/System.java:850)
        at sun.security.action.GetPropertyAction.privilegedGetProperty(java.base/GetPropertyAction.java:105)
        at java.nio.charset.Charset.defaultCharset(java.base/Charset.java:605)
        at java.lang.StringCoding.decode(java.base/StringCoding.java:329)
        at java.lang.String.<init>(java.base/String.java:610)
        at java.lang.String.<init>(java.base/String.java:632)
        at jdk.internal.util.SystemProps$Raw.vmProperties(java.base/Native Method)
        at jdk.internal.util.SystemProps$Raw.cmdProperties(java.base/SystemProps.java:253)
        at jdk.internal.util.SystemProps.initProperties(java.base/SystemProps.java:55)
        at java.lang.System.initPhase1(java.base/System.java:2002)

my system configuration is like-

  1. Ram: 8.00 GB(7.89 GB usable)
  2. OS: windows 10.
  3. processor: Intel(R) Core i5-8265U.
  4. System type: 64-bit Opearting System, x64-based perocessor.

Solution

  • Solution for windows 10:

    Open command prompt(CMD)

    1. open command prompt.
    2. type chcp and hit Enter.
    3. if output for chcp command is : Active code page: 65001 then: go to the control panel -> Region -> "Administrative" tab -> Change system locale -> Uncheck "Beta: Use Unicode UTF-8 for worldwide support".
    4. Restart your PC.
    5. Again check system local for 'beta' if it is unchecked then all is ok.
    6. if it is checked again then try to change your native language to English.