class path problem
I have a .jar file which is in c:/JUnit folder.I set the
class path as
set CLASSPATH=%CLASSPATH%;C:/JUnit/junit.jar;
I create a class SimpleTest.java(which is in c:) and tried to compile it from command prompt.But it's not finding the class files which is in junit.jar file.What setting i have to do to find the class path
[350 byte] By [
gnpa] at [2007-10-1 0:37:27]

> I have a .jar file which is in c:/JUnit folder.I set
> the
> class path as
> set CLASSPATH=%CLASSPATH%;C:/JUnit/junit.jar;
> I create a class SimpleTest.java(which is in c:) and
> tried to compile it from command prompt.But it's not
> finding the class files which is in junit.jar
> file.What setting i have to do to find the class path
This seesm to be correct. You can try removing that semicolon at the end. Not sure about it... but worth a try.
***Annie***
Usng backslashes ( ' \ ' ) instead of slashes might help, at a first glance
http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/classpath.html
Both didn't help
gnpa at 2007-7-7 16:24:28 >

Just to make sure, read this and check if you didn't make the same mistakes... http://forum.java.sun.com/thread.jspa?threadID=579769&tstart=0
the problem was in my directory name.I gave as c:/JUnit3.2.1.This will crerate problem .Compiler will look for c:/JUnit/3/2/1
gnpa at 2007-7-7 16:24:28 >

> the problem was in my directory name.I gave as> c:/JUnit3.2.1.This will crerate problem .Compiler> will look for c:/JUnit/3/2/1Oh. Didn't know that. My directory's the same, but I run JUnit from inside an IDE... thanks for telling.
I think the correct answer is that you shouldn't have a CLASSPATH environment variable. Your IDE is most likely ignoring it, since they all have their own way to learn about 3rd party JARs.J2EE containers like Tomcat ignore it, too.
Best to use the -classpath option on javac.exe when you compile and java.exe when you run on the command line. Learn how CLASSPATH works when you write Web or J2EE apps.
%
It also depends the syntax of your java command. Do you have a manifest file in your Jar file ? if not, you need to explicilty specify your startup class in the jar command.
Sorry in my prevoius append I wanted to say :.....specify explicitly your statup class in the JAVA command (and not the jar)
If I am testing something, especially things like unit tests, I dont put then in my classpath. I use netbeans ide. I like the way you can mount a jar very easily and quickyly when you need to, then unmount it when you done. Does Eclipse do the same? I just started working on eclipse today. I wanted to get a feel for both.
orozcom
> If I am testing something, especially things like
> unit tests, I dont put then in my classpath.
I think you mean "CLASSPATH environment variable" here, right?
> I use
> netbeans ide. I like the way you can mount a jar very
> easily and quickyly when you need to, then unmount it
> when you done.
But mounting a JAR that way IS effectively adding it to the CLASSPATH that NetBeans is using for that project.
My point is that IDEs ignore any system CLASSPATH you have set, and all of them have a procedure for mounting/unmounting 3rd party JARs that you need to know.
> Does Eclipse do the same? I just
> started working on eclipse today. I wanted to get a
> feel for both.
Yes, Eclipse is similar. Right click on the project folder, select Properties, and follow the links to add to the build path. Same idea as the NetBeans mounting/unmounting.
%