Peter Muhlberger
2010-Jun-08 18:51 UTC
[R-sig-Debian] Trouble compiling Java-based R packages
Hi folks: I guess my earlier posting was too involved, so let me try to get to the essence of my problem. I recently tried to compile JGR, rJava, etc. into my updated R. First, I ran: R CMD javareconf. The output from that tells me that "JAVA_HOME is not a valid path, ignoring" and the cpp flags are set to nothing. The javareconf fills most of the variables with references to openjdk. JAVA_HOME, as far as I can tell, points to a properly installed copy of Sun Java. When I run update.packages(checkBuilt=T) with this, it unsurprisingly tells me that "One or more Java configuration variables are not set" and all of my Java based programs fail to compile. I've tried switching the default Java to the Sun version using "sudo update-alternatives --config java". Now, javareconf fills in the cpp flag and variables point to the Sun version, though I still get the error msg that JAVA_HOME is not a valid path (though javareconf sets the home path to: /usr/lib/jvm/java-6-sun-1.6.0.20/jre). When I try to compile rJava, I get the error: rJava, "JNI types differ from the native type." Does anyone have any thoughts on how to fix this? Alternatively, is there somewhere I can report these problems so they might get fixed in future versions? I suspect I can't be the only person having these problems. Cheers, Peter
Dirk Eddelbuettel
2010-Jun-08 19:22 UTC
[R-sig-Debian] Trouble compiling Java-based R packages
Peter, On 8 June 2010 at 13:51, Peter Muhlberger wrote: | Hi folks: I guess my earlier posting was too involved, so let me try | to get to the essence of my problem. | | I recently tried to compile JGR, rJava, etc. into my updated R. | First, I ran: R CMD javareconf. The output from that tells me that | "JAVA_HOME is not a valid path, ignoring" and the cpp flags are set to | nothing. The javareconf fills most of the variables with references | to openjdk. JAVA_HOME, as far as I can tell, points to a properly | installed copy of Sun Java. When I run update.packages(checkBuilt=T) | with this, it unsurprisingly tells me that "One or more Java | configuration variables are not set" and all of my Java based programs | fail to compile. | | I've tried switching the default Java to the Sun version using "sudo | update-alternatives --config java". Now, javareconf fills in the cpp | flag and variables point to the Sun version, though I still get the | error msg that JAVA_HOME is not a valid path (though javareconf sets | the home path to: /usr/lib/jvm/java-6-sun-1.6.0.20/jre). When I try | to compile rJava, I get the error: rJava, "JNI types differ from the | native type." | | Does anyone have any thoughts on how to fix this? Alternatively, is | there somewhere I can report these problems so they might get fixed in | future versions? I suspect I can't be the only person having these | problems. Quick caveat: I am not a Java user or programmer. That said, I had wanted to get this work for years because several interesting packages build on-top of rjava. And as of a few years ago it started to work so I since then I am a) instrumenting Debian's r-base-core package to be Java-aware b) packaging /maintaining rjava for Debian as well but all of that only with the non-Sun packages. E.g. rjava has a build-depends on openjdk-6-jdk, and that seems to work. So start by installing that. I have also built JGR and other packages, and have the cran2deb robot build quite a few more. But never with the Sun java, and certainly never when mixing. Beyond that, maybe the Java lists can be of more help than we can here. -- Regards, Dirk