Hello all friends, I have a problem with installation of Junit I've done this job : ===================== - Downloaded Junit , unziped it , put it under : c:\junit3.8.1 - in my windows xp , i've added a new entry in "environment variable" entry name : CLASSPATH value : c:\junit3.8.1\junit.jar - i tried to run sample test using the dos prompt C:\junit3.8.1>java junit.textui.TestRunner junit.samples.AllTests
I get this result : ------------------- 'java' is not recognized as an internal or external command, operable program or batch file. i think it may be a simple problem concerning with classpath , but it really took alot of time from me . i really appreciate any help Thanks in advance
Hesham Katon<br />SCJP 1.2<br />SCWCD 1.4<br />Better to light a candle than to curse the darkness
dear Nathaniel, I am really thankful for your reply . I've tried to add j2se path , but i think i am still do it in the wrong way . I made it like this : in the system variable section : variable name : CLASSPATH variable value : c:\j2sdk1.4.2_03\bin;c:\junit3.8.1\junit.jar and this still doesnt work . i wish you can tell me exactly what is the wrong in the classpath thank you very much
Joined: May 29, 2003
Kesham, You are confusing your classpath with your executable path. One is a Java issue; one is a Windows XP issue. The two are different.
Hello Thank you very much . I think i've solved the problem with java path but i am still have another problem . Now when i am trying to run this code : java junit.textui.TestRunner junit.samples.AllTests i got this result : Class not found "junit.samples.AllTests" i think this is related with junit not java path , right ? I have already added junit to the CLASSPATH like this : C:\j2sdk1.4.2_03\lib\tools.jar;c:\junit3.8.1\junit.jar isn't this right ?
The reason why the JVM doesn't find the "junit.samples" stuff is that those packages are not inside the junit.jar file. In my JUnit 3.8.1 distribution, those classes are located in "C:\apps\junit-3.8.1\junit\samples\AllTests.class". In other words, you need to add the "C:\apps\junit-3.8.1" directory as an entry into your classpath.
If I were you guys, I would use a build tool like ant or an IDE like Eclipse (which has junit built in) to run the examples, instead of using cmd line. Trying to clean up your PATH and CLASSPATH variables that WIN XP sets is a pain. You may find that every java app server (and even applications) you install has its own JVM and resets those variables. Just use the tools!