wood burning stoves 2.0*
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
Author

Confused about setting PATHS in Windows 7

Jon Swanson
Ranch Hand

Joined: Oct 10, 2011
Posts: 200
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 x.java 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,

jri.dll
JRI.jar
JRIEngine.jar
REngine.jar

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
Hello
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.
http://download.oracle.com/javase/tutorial/java/package/managingfiles.html
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: 200
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-

META-INF
META_INF/MANIFEST.MF
org/
org/rosuda/
org/rosuda/JRI/
org/rosuda/JRI/<bunch of classes>
jri.dll

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!

 
wood burning stoves
 
subject: Confused about setting PATHS in Windows 7