How to get junit on classpath?
Jonathan Gibbons
jonathan.gibbons at oracle.com
Tue Jul 30 15:01:36 PDT 2013
What version of JUnit are you using, and does junit.jar contain
org.junit.runner.JUnitCore?
At the lowest level, you can set the location by setting the system
property "junit.jar" when you run jtreg, but that may be tricky if you
are using the Makefiles, and the fact that it is not working by default
indicates something might be wrong. If you want to try and set the
system property, make sure you set the sys prop in the JVM used to run
jtreg, and not in the JVM used to run the tests. If you use the jtreg
startup script, that means using -J-Djunit.jar=path -- note the -J prefix.
--Jon
On 07/30/2013 02:43 PM, Nick Williams wrote:
> I'm getting this error on many tests in JDK:
>
> java.lang.Exception: No JUnit 4 driver (install junit.jar next to jtreg.jar)
> [stack trace]
>
> As you can see, junit.jar is installed next to jtreg.jar:
>
> nickwilliams:jtreg Nicholas$ echo $JT_HOME
> /usr/share/java/jtreg
> nickwilliams:jtreg Nicholas$ cd $JT_HOME
> nickwilliams:jtreg Nicholas$ ls -al
> total 64
> drwxr-xr-x 12 root wheel 408 Jul 30 12:29 .
> drwxr-xr-x 15 root wheel 510 Jul 30 12:29 ..
> -rw-r--r-- 1 root wheel 994 Jul 30 12:29 COPYRIGHT
> -rw-r--r-- 1 root wheel 19241 Jul 30 12:29 LICENSE
> -rw-r--r-- 1 root wheel 3790 Jul 30 12:29 README
> drwxr-xr-x 3 root wheel 102 Jul 30 12:29 doc
> drwxr-xr-x 4 root wheel 136 Jul 30 12:29 legal
> drwxr-xr-x 7 root wheel 238 Jul 30 12:29 lib
> drwxr-xr-x 3 root wheel 102 Jul 30 12:29 linux
> -rw-r--r-- 1 root wheel 73 Jul 30 12:29 release
> drwxr-xr-x 3 root wheel 102 Jul 30 12:29 solaris
> drwxr-xr-x 3 root wheel 102 Jul 30 12:29 win32
> nickwilliams:jtreg Nicholas$ ls -al lib
> total 13200
> drwxr-xr-x 7 root wheel 238 Jul 30 12:29 .
> drwxr-xr-x 12 root wheel 408 Jul 30 12:29 ..
> -rw-r-xr-x@ 1 root wheel 4613089 Jul 30 12:29 javatest.jar
> -rw-r--r--@ 1 root wheel 508396 Jul 30 12:29 jh.jar
> -r--r--r-- 1 root wheel 542604 Jul 30 12:29 jtreg.jar
> -rw-r--r--@ 1 root wheel 245039 Jul 30 12:29 junit.jar
> -rw-r--r--@ 1 root wheel 835600 Jul 30 12:29 testng.jar
>
> I even tried setting the CLASSPATH system variable, to no avail. Made no difference one way or the other.
>
> nickwilliams:test Nicholas$ echo $CLASSPATH
> /usr/share/java/jtreg/lib/javatest.jar:/usr/share/java/jtreg/lib/jh.jar:/usr/share/java/jtreg/lib/junit.jar:/usr/share/java/jtreg/lib/testng.jar
>
> I'm running JDK8 tests using Makefile.
>
> Thoughts?
>
> Nick
More information about the jtreg-use
mailing list