Integrate Java and R – Just in a minute

Hi,
Creating a rich statistical application can become very handy and useful once you integrate Java with R.
Integration needs following to be installed already:

  1. JDK 1.5 or above ( I tried with 1.6 )
  2. R – can be downloaded from CRAN
  3. R_HOME environment variable is set.

Here is how you can integrate and configure your java to work with R:

  1. From R install the rJava package ( can be easily be done with install command in R ). The latest rJava contains JRI implicit so no need to download it manually.
  2. Go to the download directory of R  and you can see the rJava directory, and inside that there will be JRI directory include that in your java.library.path

And you are done 🙂
Enjoy !

Advertisements

2 thoughts on “Integrate Java and R – Just in a minute

  1. Hello Sir,
    I tried to integrate Java with R for any r function call in java but when i compile it give error.
    Sir tell me how would set my path & what package i load.

    Please reply

    1. Hi Alka,
      Did you put your JAR files in CLASSPATH . If not then to do that you can use
      -dclasspath option while compiling .
      Or
      Set environment variable CLASSPATH to poitn to the jars
      You’ll need : JRI.jar, JRIEngine.jar, REngine.jar to be in classpath.

      Another way is to put them in your current working directory ( its a temporary solution though)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s