File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes [JUnit] Could not find the main class junit.awtui.TestRunner Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "[JUnit] Could not find the main class junit.awtui.TestRunner" Watch "[JUnit] Could not find the main class junit.awtui.TestRunner" New topic
Author

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

Mark Pawelek
Greenhorn

Joined: Sep 03, 2010
Posts: 4
"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

Joined: Oct 12, 2001
Posts: 1179

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.


Regards, Rene Larsen
Dropbox Invite
Mark Pawelek
Greenhorn

Joined: Sep 03, 2010
Posts: 4
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: [JUnit] Could not find the main class junit.awtui.TestRunner