Question: This question is related to [this other question](https://stackoverflow.com/questions/26618105/rnetlogo-not-working-on-mac-yosemite/26723881#26723881).

I am trying to use RNetLogo with R and get the following error.

```
nl.path <- "/Applications/NetLogo 5.1.0"
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](https://stackoverflow.com/questions/26618105/rnetlogo-not-working-on-mac-yosemite/26723881#26723881), 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,

Answer: 
Unfortunately, none of these seem to help on a Mac. Windows and Linux solutions are not relevant because the files are in different places.

If you just update to Java 1.8 (Java 8 for Oracle) in the standard way as prompted by the Java preferences pain, you just get the Java Runtime Environment (JRE). If you run...

/usr/libexec/java\_home -V

...it still shows only java 1.6, and...

export JAVA\_HOME=$(/usr/libexec/java\_home -v 1.8)

...throws an error saying it can't find a version 1.8. 

To get the Mac to even recognize a newer version of Java, it seems you must install JDK v.8 (not JRE). At that point, you can get the Mac to recognize that a new java virtual machine is available, and you can do the export command successfully. (Note that the new 1.8 JVM is in a DIFFERENT place--/Library/Java instead of /System/Library/Java for 1.6.). BUT, this still does no good for R.

I've tried putting the export JAVA\_HOME... command into my .profile and my .bash\_profile. Then sourcing both. Works fine, but has no effect on R AFAICT. I've launched R via the standard Mac R GUI, from RStudio, and from the terminal and it is only recognizing Java 1.6. So RNetLogo still does not work. 

I will try to find RNetLogo 1.0-0 in the archive and test that. If it works, I suggest that 1.0-1 be rolled back until this Java problem is solved.
In Debian-based installations R uses `/etc/R/Makeconf` settings for building libraries. One of the setting there is `JAVA_HOME`. Try setting the correct path there and reinstall the package.