fink / fink-distributions

Package descriptions and patches for Fink
25 stars 38 forks source link

cran-rJava-r.info #601

Open babayoshihiko opened 4 years ago

babayoshihiko commented 4 years ago

I have made a pseudo info file for cran-rjava-r36.

how can I tell Fink detect the latest java and its JAVA, JAVAC, JAVAH?

When JAVA is updated, what will happen?

The relevant R files (bin/javareconf , etc/Makeconf , etc/ldpaths) should be treated by r-base?

cran-rjava-r.docx

nieder commented 4 years ago

In theory java_home will tell you where to find java. But on my 10.13 system with java8 installed (in 2015, but always autoupdated to latest java8 release):

$ /usr/libexec/java_home 
/Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/Contents/Home
$ /Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/Contents/Home/bin/java -version
java version "1.8.0_66"
Java(TM) SE Runtime Environment (build 1.8.0_66-b17)

BUT

$ printenv JAVA_HOME
/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
$ /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java -version
java version "1.8.0_251"
Java(TM) SE Runtime Environment (build 1.8.0_251-b08)
$ /usr/bin/java -version
java version "1.8.0_251"
Java(TM) SE Runtime Environment (build 1.8.0_251-b08)

Even 'better':

$ /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java -version
java version "1.8.0_251"
Java(TM) SE Runtime Environment (build 1.8.0_251-b08)
$ /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java_home 
/Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/Contents/Home

I hardcoded my JAVA_HOME in .bash_profile because some of my apps were using the old version in /Library/Java that java_home reports.

nieder commented 4 years ago

On a 10.14 VM that only ever got Apple's old java (which is supposed to only work to 10.13, so I don't know how it got installed there), java_home reports /Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home and there's no Java in the "Library/Internet Plug-Ins" folder.

On a 10.15 VM that has Oracle's java-12, everything points to /Library/Java/JavaVirtualMachines/jdk-1.12.0.2.jdk/Contents/Home.

In short, in theory you should be able to use /usr/libexec/java_home to set $JAVA_HOME to get the root directory for your Java (my case might be an old confused situation). But you'll need to check that the full version string for $JAVA_HOME is not being stored inside any of the files in the R packages.

babayoshihiko commented 4 years ago

Thanks for your advice. Now I made a pull request.