Bug 239388 - [80cat] JavaFX 7u45/7u51 Project: Successfully built project won't run or debug
[80cat] JavaFX 7u45/7u51 Project: Successfully built project won't run or debug
Status: NEW
Product: javafx
Classification: Unclassified
Component: Project
8.0
PC Windows 8
: P2 with 4 votes (vote)
: TBD
Assigned To: Roman Svitanic
issues@javafx
80patch-candidate
: 8.0_WAIVER_APPROVED
: 239927 240314 240505 240506 241677 (view as bug list)
Depends on: 240105
Blocks:
  Show dependency treegraph
 
Reported: 2013-12-11 21:36 UTC by Lou Dasaro
Modified: 2014-09-24 19:17 UTC (History)
11 users (show)

See Also:
Issue Type: DEFECT
:


Attachments
"Run" output from NetBeans (3.05 KB, text/plain)
2013-12-11 21:36 UTC, Lou Dasaro
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Lou Dasaro 2013-12-11 21:36:34 UTC
Created attachment 143080 [details]
"Run" output from NetBeans

JavaFX projects generated using JDK 7u45, once successfully built, won't run from the IDE, and errors are displayed (see attachment). However, the compiled /dist/JavaFXApplicationNN.jar runs just fine launching from the file system.

Also, If you change platform to JDK 8 and rebuild, it will run in the IDE. See also related error.
Comment 1 Lou Dasaro 2013-12-11 21:42:03 UTC
Product Version: NetBeans IDE Dev (Build 201312090002)
Java: 1.8.0-ea; Java HotSpot(TM) Client VM 25.0-b60
Runtime: Java(TM) SE Runtime Environment 1.8.0-ea-b118
System: Windows 8 version 6.2 running on x86; Cp1252; en_US (nb)
Comment 2 Lou Dasaro 2013-12-12 00:29:19 UTC
This error does NOT occur when NetBeans is running on 7u45. It DOES occur when running on JDK 8.
Comment 3 Roman Svitanic 2013-12-12 16:23:09 UTC
Thanks for the report.

Problem is that ant-javafx.jar (which contains FX ant tasks) from JDK8 (in this case, but generally from the default platform on which IDE runs) is present on the bootclasspath. Therefore ant uses tasks from this jar instead of the one from JDK7 project platform.
We have to investigate why this jar is on bootclasspath and which module put it there.
Comment 4 Lou Dasaro 2014-01-03 05:32:51 UTC
Hi Roman,

This is a pretty important bug, because if a user runs NetBeans on JDK 8, they can't run or debug a program configured to use JDK 7. Developers will probably use latest Java (8), but build for Java 7 since most consumers will still be on Java 7. Bug should be set to priority 2, because I think the only workaround is to tell users to uninstall NetBeans and reinstall it so it runs on JDK 7. I tested again today using:
Product Version: NetBeans IDE Dev (Build 201401020002) (Windows 8.1)
Java: 1.8.0-ea; Java HotSpot(TM) Client VM 25.0-b63
Runtime: Java(TM) SE Runtime Environment 1.8.0-ea-b121

I hope this can be resolved before NetBeans 8 RC, because I'm thinking the FCS roughly coincides with the date of the official JDK 8 release. 

If I haven't said it already, Happy New Year!
Comment 5 Roman Svitanic 2014-01-03 16:15:00 UTC
Hi Lou, thanks and Happy New Year to you, too!

As I have mentioned earlier, this issue has cause outside the JavaFX modules. Probably some other module puts */**.jar from jdk/lib on cp.

There are few easier workarounds, none of them requires uninstallation of the IDE:
1. Use JDK 8, but set source level to 7.
2. Start NetBeans with --jdkhome switch pointing to JDK 7.
3. Set "netbeans_jdkhome" property in <NetBeans Installation dir>/etc/netbeans.conf.
Comment 6 Roman Svitanic 2014-01-06 16:02:21 UTC
*** Bug 239927 has been marked as a duplicate of this bug. ***
Comment 7 swpalmer 2014-01-06 18:52:54 UTC
Lou wrote: "However, the compiled /dist/JavaFXApplicationNN.jar runs just fine launching from the file system."

This is not how it behaves for me.  The app fails to run with Java 7 even when launching outside of NetBeans.

>"c:\Program Files\Java\jre7\bin\java.exe" -jar dist\AudioVisualizer3D.jar
Exception in thread "main" java.lang.NoClassDefFoundError: javafx/scene/media/AudioSpectrumListener
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(Unknown Source)
        at java.security.SecureClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.access$100(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: javafx.scene.media.AudioSpectrumListener
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        ... 13 more
Comment 8 Lou Dasaro 2014-01-06 21:01:01 UTC
You are correct, Scott. Today, I ran java -version:1.7.0_45 -jar AudioVisualizer3D.jar, and it failed as you described.
Comment 9 Lou Dasaro 2014-01-08 08:42:25 UTC
*** Bug 240105 has been marked as a duplicate of this bug. ***
Comment 10 Lou Dasaro 2014-01-12 08:12:30 UTC
*** Bug 240314 has been marked as a duplicate of this bug. ***
Comment 11 Roman Svitanic 2014-01-15 16:25:56 UTC
*** Bug 240505 has been marked as a duplicate of this bug. ***
Comment 12 Roman Svitanic 2014-01-15 16:32:11 UTC
*** Bug 240506 has been marked as a duplicate of this bug. ***
Comment 13 Roman Svitanic 2014-02-11 08:39:46 UTC
*** Bug 241677 has been marked as a duplicate of this bug. ***
Comment 14 Lou Dasaro 2014-02-19 05:57:45 UTC
Roman's solution is a good one, my feeling is that Priority could be changed to 3 so long as this becomes well-documented. For now, I'm just going to add a little detail here:
The short answer to being able to develop in JDK 8 _and_ JDK 7 (alternately) with NetBeans 8.0 is as follows:
Start NetBeans with --jdkhome switch pointing to JDK 7.
In Windows, for example, you can change the shortcut so that it looks similar to this:

"C:\Program Files\NetBeans Dev 201402160001\bin\netbeans.exe" --jdkhome "C:\Program Files\Java\jdk1.7.0_51"

Alternatively, you could set the "netbeans_jdkhome" property in <NetBeans Installation dir>/etc/netbeans.conf e.g.
# Default location of JDK, can be overridden by using --jdkhome <dir>:
netbeans_jdkhome="C:\Program Files\Java\jdk1.7.0_51"

In either case, the project's source level must be 7 or lower to build with JDK 7, which it does just fine, and runs both in the IDE as well as jars from the command line.

In addition, even though jdkhome is set to 1.7.0_nn, you can still set the target and source level to JDK 8 if you want to code to that environment, for example, adding Lambda expressions.
Comment 15 Lou Dasaro 2014-03-19 17:53:11 UTC
For the official NetBeans 8.0 release, the workaround is documented at 
https://netbeans.org/community/releases/80/relnotes.html#known_issues-javafx
Comment 16 Lou Dasaro 2014-04-16 02:40:33 UTC
Problem continues under:

Product Version: NetBeans IDE Dev (Build 201404150001)
Java: 1.8.0_05; Java HotSpot(TM) Client VM 25.5-b02
Runtime: Java(TM) SE Runtime Environment 1.8.0_05-b13

with a target of 1.7.0_55
Comment 17 Marian Mirilovic 2014-04-18 12:16:53 UTC
Roman, any chance to fix it into Patch 1 ?
Comment 18 Roman Svitanic 2014-04-18 13:50:26 UTC
(In reply to Marian Mirilovic from comment #17)
> Roman, any chance to fix it into Patch 1 ?

Difficult to say, since it's still under investigation. We don't know which module (it isn't any JavaFX-related module) puts all jars (including ant-javafx.jar) from lib folder from platform on which IDE runs on classpath.

Adding Tomas on CC.
Comment 19 zmirc 2014-09-23 19:51:49 UTC
I just ran into this issue as well with NetBeans 8.0.1 on JDK 8. It's pretty annoying. Any progress? Any chance for a fix?
Comment 20 Lou Dasaro 2014-09-24 19:17:22 UTC
zmirc: Are you not able to use the workaround described in my comment of 2014-02-19?

Roman: Did someone file a ticket in the JavaFX Jira for this?


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