This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 211055

Summary: Can't run old JUnit project
Product: java Reporter: ulfzibis <ulfzibis>
Component: ProjectAssignee: Tomas Zezula <tzezula>
Status: RESOLVED INVALID    
Severity: normal Keywords: REGRESSION
Priority: P3    
Version: 7.2   
Hardware: PC   
OS: Windows XP   
Issue Type: DEFECT Exception Reporter:
Bug Depends on: 46298    
Bug Blocks:    
Attachments: project properties

Description ulfzibis 2012-04-12 00:28:12 UTC
[ JDK VERSION : 1.7 ]

In project.properties I have:
run.test.jvmargs.xbootclasspath=${build.test.classes.dir};"${netbeans.home}/../p
latform/modules/ext/junit-4.5.jar"
run.jvmargs=-ea
-Xbootclasspath/p:${build.classes.dir};${run.test.jvmargs.xbootclasspath}

With this, I could run JUnit tests by right-click on XyzTest.java -> "Test
File".

But in 7.2 the path for the junit library is moved to
%USERPROFILE%\.netbeans.7.2\modules\ext, so I tried:
run.test.jvmargs.xbootclasspath=${build.test.classes.dir};${libs.junit_4.classpa
th}

But I get an error (first with NB 6.9 on JDK6) (note the broken class name):

java.lang.NoClassDefFoundError: 6/9\platform\modules\ext\junit-4/5/jar
Caused by: java.lang.ClassNotFoundException:
6.9\platform\modules\ext\junit-4.5.jar
        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Could not find the main class: 6.9\platform\modules\ext\junit-4.5.jar.  Program
will exit.
Exception in thread "main"
Testsuite: java.util.AbstractCollectionTest
Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec

Testcase: java.util.AbstractCollectionTest:null:        Caused an ERROR
Forked Java VM exited abnormally. Please note the time in the report does not
reflect the time until the VM exit.
junit.framework.AssertionFailedError: Forked Java VM exited abnormally. Please
note the time in the report does not reflect the time until the VM exit.
        at
org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:154)


Test java.util.AbstractCollectionTest FAILED (crashed)
test:
Deleting:
C:\DOKUME~1\ich\LOKALE~1\Temp\TEST-java.util.AbstractCollectionTest.xml
BUILD SUCCESSFUL (total time: 1 second)


With NB 7.1.1 on JDK7 I get:

Fehler: Hauptklasse und konnte nicht gefunden oder geladen werden
Testsuite: java.util.AbstractCollectionTest
Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec

Testcase: java.util.AbstractCollectionTest:null:    Caused an ERROR
Forked Java VM exited abnormally. Please note the time in the report does not
reflect the time until the VM exit.
junit.framework.AssertionFailedError: Forked Java VM exited abnormally. Please
note the time in the report does not reflect the time until the VM exit.
    at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:153)


Test java.util.AbstractCollectionTest FAILED (crashed)
test:
Deleting:
C:\DOKUME~1\ich\LOKALE~1\Temp\TEST-java.util.AbstractCollectionTest.xml
BUILD SUCCESSFUL (total time: 3 seconds)
Comment 1 ulfzibis 2012-04-12 00:32:01 UTC
Created attachment 118165 [details]
project properties
Comment 2 Jesse Glick 2012-04-12 02:25:10 UTC
Offhand I would guess that ${libs.junit_4.classpath} expands to a path including spaces, so the trick shown here cannot work. Use the Debug Target menu item (Ant debugger) if in doubt.
Comment 3 ulfzibis 2012-04-12 12:13:50 UTC
(In reply to comment #2)
> Offhand I would guess that ${libs.junit_4.classpath} expands to a path
> including spaces, so the trick shown here cannot work.

You are correct. Double quotes helped.
I again think it's time for P2 bug 46298.