[R-SIG-Mac] What is the correct method to install a JDK on Mac OS Lion?

Simon Urbanek simon.urbanek at r-project.org
Thu Aug 25 16:58:50 CEST 2011


On Aug 21, 2011, at 10:31 AM, Bhima Pandava wrote:

> Hi,
> 
>     I'm using R.app on Mac OS Lion and when I attempt to build the 
> rJava package from source I get the following error:
> 
> Checking whether JNI programs can be compiled... configure: error: 
> Cannot compile a simple JNI program. See *config.log* for details.
> 
> Make sure you have Java Development Kit installed and correctly 
> registered in R.
> If in doubt, re-run "R CMD javareconf" as root.
> 
> ERROR: configuration failed for package 'rJava'
> * removing 
> '/Library/Frameworks/R.framework/Versions/2.14/Resources/library/rJava'
> 
> On a fresh Mac OS install, executing the command: sudo R CMD javareconf 
> fails with:
> 
>  "No Java runtime present, requesting install. Java interpreter doesn't 
> work properly." and then initiates fetching of Apple's Java runtime.
> 
> executing the command, once the Java runtime is finished completes with 
> the following output
> 
> Java interpreter : /usr/bin/java
> Java version     : 1.6.0_26
> Java home path   : 
> /System/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
> *Java library path:*
> JNI linker flags : -framework JavaVM
> JNI cpp flags    : -I$(JAVA_HOME)/include
> 
> Updating Java configuration in /Library/Frameworks/R.framework/Resources
> Done.
> 
> Attempting to build the rJava package again results in the same error as 
> before.
> 
> This causes me to ask a few questions:
> 
> 1) Is the Java package that my Mac automatically downloaded from Apple 
> the right package?

Yes


>  If not which one should I use?
> 2) Above there is no Java Library path listed, is this part of my problem?

No, OS X doesn't need it


> 3) Where is the config.log that R.app generates?  Dredging around the 
> Console.app and the likely places did not reveal it.
> 

It is deleted after the installation. You want to use the unpacked tar ball.


But to your real issue - Apple doesn't provide headers inside the Java home anymore, so you want to re-run javareconf pointing to the framework:

R CMD javareconf JAVA_CPPFLAGS=-I/System/Library/Frameworks/JavaVM.framework/Headers

(normally you don' t need sudo but if you used it once, you have to use it from then on).

Cheers,
Simon



> For what it is worth I have tried 3 different version of R at this 
> point: (R-2.13-branch, 
> <http://r.research.att.com/R-2.13-branch-leopard.pkg>R-2.13-patched for 
> Lion, R-devel)
> 
> Thanks for any help!
> 
> 	[[alternative HTML version deleted]]
> 
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
> 
> 



More information about the R-SIG-Mac mailing list