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.
While running the IDE on JDK 6 and editing a project whose target jdk is 7, when the user clicks the "run tests" button from the "Test Result" window, the tests fail to run due to class version error. The tests run using "run this file" command. Please not that running on JDK 6 is the recommended mode for running the IDE on macs with retina display. Product Version = NetBeans IDE 7.3 RC2 (Build 201302050851) Operating System = Mac OS X version 10.8.2 running on x86_64 Java; VM; Vendor = 1.6.0_37 Runtime = Java HotSpot(TM) 64-Bit Server VM 20.12-b01-434
Created attachment 131634 [details] IDE log
The only relevant information I could see in the log was: INFO: No FileObject found for the following URL: file:/Users/michael/Documents/Consulting/beeriprint/uTiyuv/AddressEnhancer/test/ and this is related to creating a test class rather than running one. Could you please attach a sample project or describe exact steps to reproduce? Reopen the bug when you do. Thank you
How to reproduce: 1. Run NetBeans 7.3 using JDK 1.6 (preferably on a Mac). 2. Create a java application project targeted for JDK1.7 3. Make a junit test that fails. 4. Run the test (shift-f6) 5. From the test results window, click the "Rerun Failed" button. This is what I get on the console window: ant -f /private/var/folders/82/wxkplqwx6g73b87b0v9x2lw00000gn/T/junit-custom-090800008/junit-custom.xml -Dplatform.java=/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java -Dclasspath=/Users/michael/Documents/Consulting/beeriprint/uTiyuv/AddressEnhancer/lib/HebrewConversions.jar:/Users/michael/Documents/Consulting/beeriprint/uTiyuv/AddressEnhancer/build/classes:/Users/michael/Documents/Consulting/beeriprint/uTiyuv/AddressEnhancer/lib/junit_4/junit-4.10.jar:/Users/michael/Documents/Consulting/beeriprint/uTiyuv/AddressEnhancer/build/test/classes -Dwork.dir=/Users/michael/Documents/Consulting/beeriprint/uTiyuv/AddressEnhancer test-custom test-custom: Created dir: /private/var/folders/82/wxkplqwx6g73b87b0v9x2lw00000gn/T/junit-custom-090800008/run-090800126 Testsuite: bp.addressenhancer.CmdArgsTest Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec Null Test: Caused an ERROR bp/addressenhancer/CmdArgsTest : Unsupported major.minor version 51.0 java.lang.UnsupportedClassVersionError: bp/addressenhancer/CmdArgsTest : Unsupported major.minor version 51.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631) at java.lang.ClassLoader.defineClass(ClassLoader.java:615) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) at java.net.URLClassLoader.defineClass(URLClassLoader.java:283) at java.net.URLClassLoader.access$000(URLClassLoader.java:58) at java.net.URLClassLoader$1.run(URLClassLoader.java:197) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:169) Test bp.addressenhancer.CmdArgsTest FAILED Deleting directory /private/var/folders/82/wxkplqwx6g73b87b0v9x2lw00000gn/T/junit-custom-090800008/run-090800126 BUILD SUCCESSFUL (total time: 0 seconds)
I can reproduce. Thank you for the steps. The problem is that the ant task tries to run the failed test with the parameter: -Dplatform.java=/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java, which is the jdk of the IDE and not with the jdk set for the project. I will work on a fix
Fixed: http://hg.netbeans.org/core-main/rev/afa77702dbaf now the jdk set for the project is queried first. If that fails for any reason the jdk the ide is running on is used.
Integrated into 'main-golden', will be available in build *201306142301* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/afa77702dbaf User: Theofanis Oikonomou <theofanis@netbeans.org> Log: #226420 - Can't run tests of JSE7 project, when IDE is on JSE6 (from the test tab)