views:

63

answers:

1

I have a ListTester.java file in which I've created with some unit tests in there to check the built in List class in Java.

I have also been given a List.class file to have the junit tests check against to make sure they are correct.

However, i'm not sure how to make sure the .class file is utilized by my .java file when it runs the tests.

How would I go about making it work? From what I was told, I can put it in the same directory as my List12Tester.java file and it should use it automatically.

+1  A: 

Use an IDE, like Eclipse. Add the directory where the List12.class resides as a dependency of your project. And tell the people giving you class-files to document and package (in a jar) their code correctly.

Christoffer Hammarström
I was using an IDE in this case, Eclipse. Your answer helped me. I ended up sticking the .class file in the "Bin" directory which had the Tester file's class file and that seemed to do the trick. Thanks for the help.
bob
This has the effect of placing the .class file in the CLASSPATH. If you are running your app from a command line then you would need to put the .class file you are given and the one generated from compiling your .java class into the CLASSPATH. The JVM will then find them as necessary when they are referenced.
Chris Nava