File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

[JUnit] Could not find the main class junit.awtui.TestRunner

 
Mark Pawelek
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Could not find the main class junit.awtui.TestRunner"

On page 35 [Agile Java, Jeff Langr] Jeff specifies the command:

java -cp .;C:\Programs\junit4.9\junit-4.9.jar junit.awtui.TestRunner StudentTest

I am executing this from the directory where I just compiled my StudentTest class. [see p35], amending his instruction to accomodate my JUnit installation.

I get an error back with 8 lines which includes the message:

Could not find the main class junit.awtui.TestRunner.

Likewise:

java -cp .;C:\Programs\junit4.9\junit-4.9.jar junit.swingui.TestRunner StudentTest

gives:

Could not find the main class junit.swingui.TestRunner.

alternatively:

java junit.textui.TestRunner StudentTest

give the error:

Class not found StudentTest

Up to this point I can compile .java programs from the command line.

PS:
1. This where I put JUnit: C:\Programs\junit4.9\junit-4.9.jar
2. My JAVA_HOME is set to: C:\Programs\Java\jdk1.6.0_21
3. I'm running this under Windows XP
4. I'm using the most recent versions of these java files.
5. It goes without saying that I'm not using an IDE at this stage.

PS 2:
Googling: "Could not find the main class junit.swingui.TestRunner" gives 1 English entry to Mannings' Testing With JUnit. Reading that gets me no further.

 
Rene Larsen
Ranch Hand
Posts: 1179
Eclipse IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah, the GUI TestRunners have been removed from version 4+ - maybe because most developers now uses some kind of IDE where the JUnit GUI is part of ??

You can however copy swingui and awtui runner from junit prior version 3.8.2 junit.jar, and paste it into junit4x.jar/junit folder and try - it should work.
 
Mark Pawelek
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Rene

Running this gives me something:

java -cp .;C:\Programs\junit4.9\junit-4.9.jar junit.textui.TestRunner StudentTest

I will use the textui runner until chapter 3, at which point the tutorial book I'm using moves on to using an IDE; unless I accost another compatibility issue, in which case, I might just try using Java 5 in place of 6.

Note to moderator: This thread really belongs in The Beginning Java forum.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic