This question is related to this other question.
I am trying to use RNetLogo with R and get the following error.
nl.path
NLStart(nl.path)
Error in .jnew("nlcon/Preprocess") :
java.lang.UnsupportedClassVersionError: nlcon/Preprocess : Unsupported major.minor version 51.0
From what I understood in this other question, the problem is that R is using an old version of Java which is incompatible with RNetLogo.
I installed Java 8.0 hoping to solve the problem but my understanding is that, despite Java 8.0 being installed on my computer (Mac OS Maverick), R does not pick it up and keep trying to use old versions of Java.
So my question is : How can I get R to use Java 8.0 instead of any older version?
In the terminal console, I get
java -version :
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)
Thanks in advance for your help,
解决方案
Seems like on Mac OS X you can have multiple Java at a one time.
Use below command on terminal to check how many JDK version you have.
/usr/libexec/java_home -V
You can follow below instruction to have correct Java Path setup:
In nutshell do:
export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)