I have unsuccessfully tried to update my Java to the latest version (1.8.0_151) in order to use some packages in R.
My current version of OSX is macOS Sierra version 10.12.6.
I tried this solution (being able to select the version of Java that I want via the Terminal) but have not been able to get it to work mostly because the latest version is not showing up in my call in the Terminal for:
/usr/libexec/java_home -V
In my Terminal I still see:
Matching Java Virtual Machines (2):
1.6.0_65-b14-468, x86_64: "Java SE 6" /Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
1.6.0_65-b14-468, i386: "Java SE 6" /Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Where I am expecting to see something like the below (copy and paste from the first solution), even though I have downloaded the latest version of Java and confirmed that it's that latest via my System Preferences.
Matching Java Virtual Machines (3):
1.8.0_05, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home
1.6.0_65-b14-462, x86_64: "Java SE 6" /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
1.6.0_65-b14-462, i386: "Java SE 6" /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
/Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home
Additionally, I have tried this solution, which attempts to re-set the JAVA_HOME within the bash but I do not have permission.
Apologies if I am missing something basic, I have not worked in the Terminal and do not know what it means that I do not have permission / how to update my profile for the latest version of Java.
Additionally, I have tried the following in my Terminal
R CMD javareconf
Which produces the following error, as opposed to mapping to the appropriate version of Java:
Java interpreter : /usr/bin/java
Java version : 1.6.0_65
Java home path : /Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Java compiler : /usr/bin/javac
Java headers gen.: /usr/bin/javah
Java archive tool: /usr/bin/jar
System Java on macOS
trying to compile and link a JNI program
detected JNI cpp flags : -I/System/Library/Frameworks/JavaVM.framework/Headers
detected JNI linker flags : -framework JavaVM
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/System/Library/Frameworks/JavaVM.framework/Headers -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -fPIC -Wall -mtune=core2 -g -O2 -c conftest.c -o conftest.o
conftest.c:4:5: warning: 'JNI_CreateJavaVM' is deprecated
[-Wdeprecated-declarations]
JNI_CreateJavaVM(0, 0, 0);
^
/System/Library/Frameworks/JavaVM.framework/Headers/jni.h:1936:39: note:
'JNI_CreateJavaVM' has been explicitly marked deprecated here
_JNI_IMPORT_OR_EXPORT_ __attribute__((deprecated)) jint JNICALL
^
1 warning generated.
clang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o conftest.so conftest.o -framework JavaVM -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
JAVA_HOME : /Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Java library path:
JNI cpp flags : -I/System/Library/Frameworks/JavaVM.framework/Headers
JNI linker flags : -framework JavaVM
Updating Java configuration in /Library/Frameworks/R.framework/Resources
Done.
How can I ensure that the recently downloaded version of Java is being utilized and add it to my profile?
Any and all help would be greatly appreciated!
--UPDATE--
I have been able to map the appropriate JDK version to my .bash_profile
by following these youtube steps.
The issue still remains in RStudio where it is not pulling the right Java version when I try to install the RWeka package.
How can I link the appropriate version in my RStudio?
The error for RWeka installation is below:
** package ‘RWeka’ successfully unpacked and MD5 sums checked
Need at least Java version 1.7/7.0.
ERROR: configuration failed for package ‘RWeka’
* removing ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library/RWeka’
Warning in install.packages :
installation of package ‘RWeka’ had non-zero exit status