Romain Francois, Professional R Enthusiast - TipIndependant statistical/R consultant2013-03-24T15:53:22+01:00Romain Francoisurn:md5:2cdb21a695f56bfe2b31ee2133c51b42DotclearTip: get java home from R with rJavaurn:md5:068b5eee15e5617c8b725a0e4052afee2009-09-02T09:38:00+02:00romain francoisTipjavaR <p>Assuming rJava is installed and works, it is possible to take advantage of its magic to get the path where java is installed:</p>
<pre>
$ Rscript --default-packages="methods,rJava" -e ".jinit(); .jcall( 'java/lang/System', 'S', 'getProperty', 'java.home' ) "
[1] "/opt/jdk/jre"
</pre>
<p>This is useful when you develop scripts that need to call a java program without assuming that java is on the path, or the JAVA_HOME environment variable is set, etc ...</p>