views:

307

answers:

2

Hi, I am not a java developer. I just want to run a java application (which can be downloaded from: http://code.google.com/p/k-shortest-paths/downloads/list , under this name: KShortestPaths_Java_v2.1.zip)

While trying to compile test\edu\asu\emit\qyan\test\YenTopKShortestPathsAlgTest.java I get "package ... does not exist" and "symbol ... does not exist" which I know are related to path setting. Can you please tell me how I should set environment variables and from which directory compile and run that java file? (My operating system is Windows XP and I have saved the application in C:\KSh)

Edit: I resolved the problem with compiling. Now, I have a CLASS file: YenTopKShortestPathsAlgTest. However, when I try to run it with java, I get this error: "could not find the main class... program will exist" which I guess is again related to the paths other jar files are located. Could you please kindly give me a hint?

+1  A: 

The zip file contains a .classpath and a .project file. These files are used by the eclipse java IDE.

Perhaps the most easy way would be to download eclipse and import the project there.

If you want to do it by hand, try

javac -sourcepath src;test test\edu\asu\emit\qyan\test\YenTopKShortestPathsAlgTest.java

from your directory C:\KSh.

EDIT:

Download junit.jar and add it to the classpath with

javac -classpath junit.jar -sourcepath....
tangens
Thanks. First there was 18 errors, but now I have still 1 "package org.junit does not exist" error and 4 "cannot find symbol" errors as follows:Symbol: class Testlocation: class edu.asu.emit.qyan.test.YenTopKShortestPathsAlgTest@Test
Matin
@Matin - JUnit is a test framework library available from http://www.junit.org/ You will need to add the appropriate JAR dependency to your classpath.
McDowell
Sorry for being such a beginner, but where should I save it? I still have those errors?
Matin
Thank you all, it is working now.
Matin
+1  A: 

You need to point the classpath to the name of the .jar files, and/or the name of the directory containing your class files e.g.

CLASSPATH=c:\dir\myjar.jar;c:\classes

so you list the .jars required and the directories involved, separated by semicolons. You can either set the CLASSPATH environment variable, or use the above directly with javac thus:

javac -cp c:\dir\myjar.jar;c:\classes {source files}
Brian Agnew