Version 16 (modified by antonio, 7 years ago) (diff)

--

# JRE Installation

Installation of the Java Platform, Standard Edition Runtime Environment (JRE), allows you to run Java programs on your PC and as you browse the Internet. The ecomsUDG.Raccess package needs the JRE in order to use the powerful capabilities of the netCDF Java Library.

It is very likely that JRE is already installed on your computer, but just in case it is not, here are some instructions on how to get it.

### Linux users

To find out if JRE is installed in your machine, and in negative case to get instructions on how to install it, please refer to this link

### Windows / Mac users

Click on the link below to download the JRE installer and perform the installation procedure by keeping the default installer settings. For Windows users, please be sure that you have downloaded the 32-bit JRE installer as indicated below.

# Installing the rJava package

rJava is a R package providing a low-level interface to Java from R. If Java is installed and adequately configured in your computer, the rJava package will be automatically downloaded if not present when installing the ecomsUDG.Raccess package, as any other package dependency.

Therefore, in principle you should not worry about this and could skip this section. But just in case something related to rJava goes wrong during the installation, please bear in mind the following information:

Once Java is installed in your machine, in most cases the following call from R should do the trick:

> install.packages("rJava")


### Linux

Linux users can alternatively use the apt-get choice from the terminal:

~\$ apt-get install r-cran-rjava


(In case of doubts, there is a recent discussion on both choices at this link that you may find helpful).

You can also find useful information about the installation and configuration of openJDK in this thread of the Ubuntu forum.

### Mac OS X

Mac OS X comes with Java pre-installed, so everything should ‘just work’.

But if you are having problems with newly installed Java version please take a look to this: http://stackoverflow.com/questions/26948777/how-can-i-make-rjava-use-the-newer-version-of-java-on-osx

### Windows

For Windows 7, you can find some quick advice on how to get up and running with R + rJava at this link

If an error likes this one appears on your R console:

Error : .onLoad failed in loadNamespace() for 'rJava', details:
call: inDL(x, as.logical(local), as.logical(now), ...)
error: unable to load shared object 'C:/Users/antonio/Documents/R/win-library/3.2/rJava/libs/x64/rJava.dll':
LoadLibrary failure:  %1 no es una aplicación Win32 válida.

Error : package 'rJava' could not be loaded


it can be due to a misconfiguration of JAVA_HOME environment variable.

Please check that the corresponfing value points to the correct Java version and bit architecture (32 or 64).

> Sys.getenv("JAVA_HOME")


You can remove from system environment and restart R or remove from R sesssion:

> if (Sys.getenv("JAVA_HOME")!="")
+     Sys.setenv(JAVA_HOME="")


or you can force the JVM ():

> Sys.setenv(JAVA_HOME="C:\\Program Files (x86)\\Java\jdk1.7.0\\jre")


and check which JVM is using rJava:

>.jinit()
> .jcall("java/lang/System", "S", "getProperty", "java.vendor")
[1] "Oracle Corporation"
> .jcall("java/lang/System", "S", "getProperty", "java.runtime.version")
[1] "1.7.0-b147"
> .jcall("java/lang/System", "S", "getProperty", "os.arch")
[1] "x86"


# Find out the java version used by R

Once rJava is installed, you may want to know the characteristics of the java version used by R:

library(rJava)
.jinit()
[1] 0
.jcall("java/lang/System", "S", "getProperty", "java.vendor")
[1] "Oracle Corporation"
.jcall("java/lang/System", "S", "getProperty", "java.runtime.version")
[1] "1.7.0-b147"
.jcall("java/lang/System", "S", "getProperty", "os.arch")
[1] "x86"