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 210613 - SwingInterop sample doesn't start in NB 7.1.2 on Mac with JDK/FX bundle
Summary: SwingInterop sample doesn't start in NB 7.1.2 on Mac with JDK/FX bundle
Status: VERIFIED FIXED
Alias: None
Product: javafx
Classification: Unclassified
Component: Project (show other bugs)
Version: 7.1.2
Hardware: PC Mac OS X
: P1 normal (vote)
Assignee: Petr Somol
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-04-03 12:21 UTC by Stepan Zebra
Modified: 2012-07-09 17:27 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stepan Zebra 2012-04-03 12:21:04 UTC
Product Version: NetBeans IDE 7.1.2 (Build 201203242206)
Java: 1.7.0_04-ea; Java HotSpot(TM) 64-Bit Server VM 23.0-b19
System: Mac OS X version 10.7.3 running on amd64; US-ASCII; en_US (nb)

Sample created via New Project > Samples > JavaFX > SwingInterop with Default JavaFX Platform set to JDK/FX bundle doesn't start from IDE.

Output:
run:
Exception in thread "main" java.lang.NoClassDefFoundError: javafx/embed/swing/JFXPanel
	at java.lang.Class.getDeclaredMethods0(Native Method)
	at java.lang.Class.privateGetDeclaredMethods(Class.java:2442)
	at java.lang.Class.getMethod0(Class.java:2685)
	at java.lang.Class.getMethod(Class.java:1620)
	at sun.launcher.LauncherHelper.getMainMethod(LauncherHelper.java:492)
	at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:484)
Caused by: java.lang.ClassNotFoundException: javafx.embed.swing.JFXPanel
	at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
	... 6 more
Java Result: 1

When the sample is created with FX Platform set to standalone FXSDK, there is no error and it runs.
Comment 1 Petr Somol 2012-04-05 15:26:52 UTC
fixed in jet-main:
http://hg.netbeans.org/jet-main/rev/42ba4227125b

Note that this is a workaround of a Mac JDK7u4 specific problem that is almost certainly out of NB scope. The exact cause inside JDK7u4 is not yet known and is unlikely to be fixed before NB 7.1.2 GA. The observed behavior is this: when jfxrt.jar is prepended to bootclasspath, the classes in it may not be accessible from application main class. When instead jfxrt.jar is appended to bootclasspath, the problem does not manifest itself. NB project metafiles by default prepend FX jars. The workaround in this specific case consists in modifying build-impl so that jfxrt.jar is appended instead of prepended. This change is transparent for users; SwingInterop runs identically as before on any supported JDK/FXSDK and now also with JDK7u4 on Mac.
Comment 2 Quality Engineering 2012-04-06 01:20:55 UTC
Integrated into 'releases', will be available in build *201204052205* or newer. Wait for official and publicly available build.
Changeset: http://hg.netbeans.org/releases/rev/a6546a1a9c0b
User: Petr Somol <psomol@netbeans.org>
Log: #210613 SwingInterop sample doesn't start in NB 7.1.2 on Mac with JDK/FX bundle
Comment 3 Quality Engineering 2012-04-08 09:53:56 UTC
Integrated into 'main-golden', will be available in build *201204080400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/42ba4227125b
User: Petr Somol <psomol@netbeans.org>
Log: #210613 SwingInterop sample doesn't start in NB 7.1.2 on Mac with JDK/FX bundle
Comment 4 Stepan Zebra 2012-04-16 12:52:39 UTC
verified in 7.1.2
Comment 5 PaulAsgteach 2012-07-06 21:43:21 UTC
I am seeing this problem with NetBeans IDE 7.2 RC1 with Java(TM) SE Runtime Environment (build 1.7.0_05-b05)
Java HotSpot(TM) 64-Bit Server VM (build 23.1-b03, mixed mode) on Mac OSX (both 10.7.2 and 10.7.4).

Also had problems with NetBeans IDE 7.2Beta and 7.1.2.

New projects built with template JavaFX in Swing Application fail with java.lang.NoClassDefFoundError: javafx/embed/swing/JFXPanel (exact stack output as shown below) and Samples | JavaFX | SwingInterop fails with java.lang.NoClassDefFoundError: javafx/scene/chart/Chart

It sounds like this is supposed to be fixed.

Is there a workaround?
Comment 6 Stepan Zebra 2012-07-09 07:05:23 UTC
(In reply to comment #5)
> ...
> It sounds like this is supposed to be fixed.

The problem is still not resolved. This issue is closed because it covers only the workaround for the SwingInterop sample in 7.1.2.

> Is there a workaround?

Workaround is to switch bootclasspath prepending to appending in your FX in Swing projects. This needs to be done manually.
To do so, switch to "Files" tab in NB. Expand your project node, expand it's "nbproject" node. Open the "build-impl.xml". Find "Xbootclasspath/p" inside the file, and change the "p" after the slash to "a".
Sorry for the inconvenience.
Comment 7 gailanderson 2012-07-09 17:27:09 UTC
(In reply to comment #6)
> (In reply to comment #5)

> Workaround is to switch bootclasspath prepending to appending in your FX in
> Swing projects. This needs to be done manually.
> To do so, switch to "Files" tab in NB. Expand your project node, expand it's
> "nbproject" node. Open the "build-impl.xml". Find "Xbootclasspath/p" inside the
> file, and change the "p" after the slash to "a".
> Sorry for the inconvenience.


Thank you. That worked.