Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 211055 - Can't run old JUnit project
Can't run old JUnit project
Status: RESOLVED INVALID
Product: java
Classification: Unclassified
Component: Project
7.2
PC Windows XP
: P3 (vote)
: TBD
Assigned To: Tomas Zezula
issues@java
: REGRESSION
Depends on: 46298
Blocks:
  Show dependency treegraph
 
Reported: 2012-04-12 00:28 UTC by ulfzibis
Modified: 2012-04-12 12:13 UTC (History)
0 users

See Also:
Issue Type: DEFECT
:


Attachments
project properties (2.64 KB, application/octet-stream)
2012-04-12 00:32 UTC, ulfzibis
Details

Note You need to log in before you can comment on or make changes to this bug.
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.


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo