سؤال

I have a problem that allegedly isn't possible, so I'm having a heck of a time finding an answer.

I have the latest version of NetBeans 7.4, running on fully-updated Fedora 20 x64. Officially, this can work with JavaFX. Period. I have both the JDK from the repo (1.7.something) and the very latest version I could find (1.8.0). Officially, these have JavaFX with them. Period.

If I try to create a new JavaFX project, it has this to say:

Failed to automatically set-up a JavaFX Platform. Please go to Platform Manager, create a non-default Java SE platform, then go to the JavaFX tab, enable JavaFX and fill in the paths to valid JavaFX SDK and JavaFX Runtime. Note: JavaFX SDK can be downloaded from JavaFX website.

Well alright, I'm used to things getting confused, I think I can fix this. Go create a new platform, and... there's no "JavaFX" tab. It took a bit of research to even find out what it was talking about, and in the process I discovered that the tab has actually been removed from 7.4. Because NetBeans 7.4 will absolutely, definitely recognize JavaFX automatically. Period.

Going to the actual JavaFX site tells me, as expected, that it's bundled with the Java SE 7 JDK I already have. Period.

Since the end result I'm after could technically be achieved by integrating one JavaFX component into my Swing application, I attempted that, but NetBeans still can not find anything related to JavaFX and therefore yells at me if I try to import such a thing.

So, given that things that are supposed to just plain work just plain aren't... where can I go from here?

هل كانت مفيدة؟

المحلول 2

Apparently, the issue is indeed a discrepancy between the open-source OpenJDK provided by most Linux distributions, and the proprietary Oracle JDK. Ironically, this is a well-known issue, but you have to specifically search for it to find it, and by then you already know.

The solution is to download the official Oracle JDK, and if necessary create the matching platform in NetBeans (located under /usr/java/jdk... at this moment). It should work perfectly fine after that.

نصائح أخرى

Currently in Debian and Ubuntu (probably others) JavaFX is a separate package from the OpenJDK (openjdk-8-jdk) and so needs to be installed:

sudo apt-get install libopenjfx-java libopenjfx-java-doc

Notable issue (this issue does not impact a Maven, JavaFX application so if that is your preferred build method then ignore the following issue):

If you try to create a new project: Categories > JavaFX Project > JavaFXApplication

You'll get:

Internal error. Missing resources [/resources/web-files/javafx-loading-100x100.gif] 
/home/ken/NetBeansProjects/vestFxReports/nbproject/jfx-impl.xml:1465: The following error occurred while executing this line: 
/home/ken/NetBeansProjects/vestFxReports/nbproject/jfx-impl.xml:3093: The following error occurred while executing this line: 
/home/ken/NetBeansProjects/vestFxReports/nbproject/jfx-impl.xml:2055: Error: -includedt requires the java deployment toolkit, which is not included in this distribution 
BUILD FAILED (total time: 1 second)

To fix the above error [following steps are derived from here: http://hongouru.blogspot.com.uy/2015/09/solved-error-building-new-project-using.html]:

  1. Switch to the files tab (usually you're on the Project tab).
  2. Expand the node for your project > expand the nbproject node > open the "project.properties" file.
  3. Find the line javafx.deploy.includeDT=true and change true to false.

Now you can create and run a JavaFX application, on OpenJDK.


Next steps, although beyond the issue at hand you'll probably at some point want to download the JavaFX scene builder: http://www.oracle.com/technetwork/java/javafxscenebuilder-1x-archive-2199384.html

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top