Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add Java FX 2.0 to existing Netbeans project

I have an existing Java project in Netbeans that uses Swing and I would like to start using Java FX 2.0 for some components in that project. I have dowloaded the latest version of the JDK (1.7.0_03) and enabled JavaFX but when I try adding an import javafx.xxx statement, Netbeans can't resolve the link. Do I need to manually add some JARs to my list of external libraries?

Project Properties use "JDK 1.7-FX Enabled":

enter image description here

which is configured this way:

enter image description here

like image 412
assylias Avatar asked Mar 12 '12 17:03

assylias


People also ask

How do I add an FX to an existing Java project?

Click on the File menu and select Project Structure . In the dialog that appears, select the Libraries tab and click the + icon to add a new Java library: Find your javafx-sdk folder and select the lib subfolder: Click the OK button to complete the process.

How add JavaFX to NetBeans?

Right-click the Libraries folder in your project, select the Add Library... command, then choose JavaFX 13 from the list of global libraries. If you don't have that library, then you need to go back to the previous section. Finally, add a new JavaFX Main Class... to the project's package.

How do I open an existing JavaFX project in NetBeans?

Tools -> Plugins -> Installed (Tab) -> Select JavaFX plugins and click on Activate them. JavaFX has been enabled in my NetBeans. Save this answer.

Can I use JavaFX in NetBeans?

This tutorial provides step-by-step instructions for integrating JavaFX features into a NetBeans Platform application. Since the NetBeans Platform is typically used as a basis for corporate applications, the JavaFX chart components are ideal candidates for integration into NetBeans Platform applications.


1 Answers

If you created your project in older NetBeans it can miss libraries from FX enabled plaftorm.

You can:

  • either recreate the project in NetBeans 7.1+ and copy sources
  • or include next library to the libs: C:/Program Files/Oracle/JavaFX 2.0 SDK/rt/lib/jfxrt.jar
like image 63
Sergey Grinev Avatar answered Oct 16 '22 09:10

Sergey Grinev