==
Error occurred during initialization of VM
java.lang.NullPointerException
at java.util.Hashtable.put(Hashtable.java:542)
at java.lang.System.initProperties(Native Method)
at java.lang.System.initializeSystemClass(System.java:1115)==
One fine day when I am trying to run java
command in my Mac OSX, I got the above exception trace. running java -verbose
didn't give any clue apart from showing some traces of the list of classes loaded. There were several suggestions on the internet to increase memory, reboot, setting the PATH
environment variable to java bin directory etc., But none of them solved my problem.
I opened the System.java
file from JDK source, that originally showed up in the stack trace and noticed that when trying to set some properties during initialization it fails. Since it's related to path i decided to install the native version of java that comes with Mac OSX which can be downloaded and installed from the following location.
and voila it worked. It seems that the native installer is setting up some configuration and path in /Libaray/Frameworks/JavaVM.Framework which is necessary for any version of the Java to work in Mac.
Have a good time !