(This article was first published on

**R – StudyTrails**, and kindly contributed to R-bloggers)Setting up R-Java in Netbeans is pretty straight forward. For those who need a walkthough here are the steps.

- Download and install R (for this example version 2.12.2). install rJava package.
- Download and install Netbeans.
- In Netbeans Create a new java project. we will call it RJava.
- From the [R_HOME]>/library/rJava/jri/examples folder, copy the file rtest.java into the project.
- Create a library in NetBeans and add the following jars to the library. – JRI.jar, JRIEngine.jar, REngine.jar. These files are present in [R_HOME]/library/rJava/jri/. Here’s how the project looks like
- Minimize Netbeans. Add R_HOME variable (right click my computer-> properties-> Advanced ->Environment variables) R_HOME should point to the location where R is installed.
- edit the PATH variable and append the following (i) [R_HOME]libraryrJavajri and (ii) [R_HOME]bin

That’s it. Right click on rtest.java and click on ‘Run File’.

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 on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...