aspose file tools*
The moose likes Testing and the fly likes package junit.framework does not exist Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Testing
Bookmark "package junit.framework does not exist" Watch "package junit.framework does not exist" New topic
Author

package junit.framework does not exist

Stephen Spiteri
Greenhorn

Joined: Mar 10, 2005
Posts: 2
Hi, Im new to junit and javaranch actually, could anyone help me out??

Ive tried installing junit by unzipping it to c:\junit3.8.1\ and set the environment

set classpath=%classpath%;C:\junit3.8.1\junit.jar

(which to the best of my knowledge is right... but when trying to compile a java file i get:

C:\Antbook\ch06\test>javac org\example\antbook\junit\SimpleTest.java
org\example\antbook\junit\SimpleTest.java:3: package junit.framework does not exist
import junit.framework.TestCase;
^
org\example\antbook\junit\SimpleTest.java:5: cannot resolve symbol
symbol : class TestCase
location: class org.example.antbook.junit.SimpleTest
public class SimpleTest extends TestCase
^
org\example\antbook\junit\SimpleTest.java:13: cannot resolve symbol
symbol : method assertTrue (boolean)
location: class org.example.antbook.junit.SimpleTest
assertTrue(4 == (2 * 2));
^
3 errors

What have i done wrong??

Thanks
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
How are you compiling your code? Are you using some sort of a batch script? If you are, could you post it for us to see?


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Stephen Spiteri
Greenhorn

Joined: Mar 10, 2005
Posts: 2
im just doing javac to compile it,

the code for the java file is:


Its the import bit that goes wrong, so i have a feeling its the installation of junit thats the problem.
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Does it compile if you do this?
javac -classpath %CLASSPATH%;C:\junit3.8.1\junit.jar org\example\antbook\junit\SimpleTest.java
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: package junit.framework does not exist