• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JUnit installation problem

 
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hesham,
You haven't correctly set the PATH variable on your XP box. Once you do that you shouldn't have any problems. You need to include your "bin" directory of your J2SE installation in it.
 
hesham katon
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Nathaniel Stoddard
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hesham,
Also note that the problem is with java, not junit. As recommended above, check that java is in your PATH environment variable.
 
hesham katon
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ?
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
hesham katon
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

this is finally done
i want to thank all of you very much
Thanks to Nathaniel Stoddard , Jeanne Boyarsky , & Lasse Koskela
your replies were really helpful
 
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have also setup junit for the first time, and my rekated environment variables are:

CLASSPATH = %JUNIT_HOME%\junit.jar;%JUNIT_HOME%

JUNIT_HOME = C:\junit3.8.1

Path = %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\ATI Technologies\ATI Control Panel;C:\Program Files\Perforce

and now i am able to run

junit.tests.extensions.AllTests

but not:

junit.samples.AllTests

Any ideas ?

Thanks,
-Kamal.
 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks very much,
Coz of your chatting, I also can configure my JUnit 3.8.1 that the program was the same, now it is fixed.

Thanks for all your detail.

Hope to have more discuss together,

Regards,
Mr. Metrey,
 
What kind of corn soldier are you? And don't say "kernel" - that's only for this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic