R and Java – JRI using eclipse on 64 bit machines

[This article was first published on R – StudyTrails, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Update – Check out the new RJava Eclipse Plugin.
The steps to install rjava on a 64 bit machine is not very different from installing it on a 32 bit machine. however, here are the exact steps.

1. Install 64 bit java.
2. Install R 2.12.X
3. Start R and install the rjava package using the package installer.
4. Start eclipse. Create a project called RTest. copy the Rtest.java and RTest2.java files from the examples folder of rjava (R-2.12.2libraryrJavajriexamples)
5. Create a lib folder in the RTest project and copy the jri.jar file from R-2.12.2libraryrJavajri into it.
6. add jri.jar to the classpath of the project. ensure that the project compiles without error.
Here’s the folder structure

7. Before running the RTest.java class, the run configuration needs to be edited. open the run configuration by clicking on run->run configuration. select Rtest as project and rtest as the main class. click on environment and add the variable ‘PATH’ . the path should contain paths to the following
a. the bin directory of R (64) : R-2.12.2binx64;

b. The jri directory for rjava (64bit) : R-2.12.2libraryrJavajrix64.


8. click on apply and then run.

To leave a comment for the author, please follow the link and comment on their blog: R – StudyTrails.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)