It's not a secret anymore!
The moose likes Beginning Java and the fly likes Confused about setting PATHS in Windows 7 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Confused about setting PATHS in Windows 7" Watch "Confused about setting PATHS in Windows 7" New topic

Confused about setting PATHS in Windows 7

Jon Swanson
Ranch Hand

Joined: Oct 10, 2011
Posts: 214
Thanks to some excellent help on another question, I am happily building Java applications on my Windows 7 machine. However, I am hoping to use the statistical package R and would like to call it from Java.

I have installed R, I have installed a package for R called JRI. It comes with some java test files and they don't run. I think my problem might be knowing how to import packages other than those that come with the JRE.

I just set path to get Java to run.

in my path let's me run javac and java x just fine.

I also have R in my path

and it runs just fine using the Rterm command.

JRI is installed as part of rJava in the R directory tree. I see these files, which seem to be what I want,


so I added

to the path. This is where these files were installed.

Then I try to run their test program-

I get errors compiling it. There are 30 of them and mostly they are "can't find symbol." But the ones that I think actually matter are-

"package org.rosuda.JRI does not exist."

So... I think there is just something simple I don't understand about Java. Could someone set me straight?

Of course, I'd love to know what the best package is for running R from Java, JRI is the only one I found. Or if there are any Java/R experts that would like to point me to a good tutorial, that would also be great!

Gaurav Raje
Ranch Hand

Joined: Jul 23, 2010
Posts: 136
I think you are confusing between path and classpath. Path is what you need to add in order for your shell (or dos prompt) to find the executable file. Classpath is the java equivalent. It is the path that the JVM must search in order to find the classes. So if you have jars, you might want to add the jars to the classpath.
This is one tutorial. Though you might be able to find simpler tutorials online on setting classpaths.

PS: Make sure that the jar file is in teh classpath, not just the directory it is in
Jon Swanson
Ranch Hand

Joined: Oct 10, 2011
Posts: 214
Thanks. So I have the jar files in

so I do this in my DOS window

Same errors.

I was looking at-

Java Package Tutorial

which I thought gave a pretty clear explanation of CLASSPATH. So I am even more confused now, since the test program still claims it cannot find the package.

I tried jar -tvf JRI.jar, the results look right-

org/rosuda/JRI/<bunch of classes>

all the imported classes appear to be in the JAR file.

Oh! I reread your e-mail and changed the CLASSPATH to

and it compiled. I misread the last line of the reference I mentioned above.

Thanks very much!

I agree. Here's the link:
subject: Confused about setting PATHS in Windows 7
It's not a secret anymore!