0

My professor has given us an assignment to implement two interfaces and he has built a tester for each interface. I have written my code, but when I run the testers I always get stuck at the line to specify which implementation to test. Here is a link to the website so you can view the testers. I have no idea what to do. If I need to provide anymore information let me know.

https://www.cct.lsu.edu/~sbrandt/csc1351/06/1351-merge-sort.php

Shobosy
  • 50
  • 1
  • 6

2 Answers2

0

In MTester.java and MTesterL.java, you can see the line Class<?> c = Class.forName(args[0]); . That means that you need to pass to the java test program the name of your Implementation. Look how to pass args to main here: https://stackoverflow.com/a/19648592/5947244

Community
  • 1
  • 1
  • The steps were a bit different since we use Netbeans instead of Eclipse, but that solution worked. – Shobosy Feb 25 '16 at 22:41
0

When I understand your problem and the tester code currently, you need to pass the full class name of your implementation as the command line argument of the program.

Assuming all the source files are the current directory and all are in the default package (have no package declared on top) and your implementation is in a file MSorter.java, the command line could look like:

> javac -cp . *.java
> java -cp . Tester MSorter
> java -cp . MTesterL MSorterL
Arne Burmeister
  • 20,046
  • 8
  • 53
  • 94