How to use different JVM in mac ??

The other day i wanted to test something on JVM 7 .
There are many post related to this some are very complex to setup  i wanted to have something quick juggad
after googling and help from my friend here is the easy way to do it .

Steps :
1 . define JAVA_HOME variables
$ vim .bash_profile

here , here i comment JDK 8 version as now i want to use 7 .
#export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_111.jdk/Contents/Home
export JAV_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home

2. compile :
$ source .bash_profile

3.$ echo $JAVA_HOME
here you will see /Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home but in order to use it we have to hit following command .

4 . $ /usr/libexec/java_home -v 1.7

and here it worked for me .

I refer This post .

For details please refer ..


Leave a Reply

Your email address will not be published. Required fields are marked *