<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> | |
<!-- | |
Copyright (c) 2011, 2012, 2013, Oracle and/or its affiliates. All rights reserved. | |
--> | |
<html> | |
<head> | |
<title>Setting Up NetBeans IDE With JavaFX</title> | |
<meta name="KEYWORDS" content="NETBEANS, JAVAFX"> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
<meta name="DESCRIPTION" content="How to set up NetBeans IDE to use JavaFX" > | |
<link rel="stylesheet" type="text/css" href="../../../netbeans.css" media="screen"></head> | |
<body> | |
<h1>Setting Up NetBeans IDE With JavaFX</h1> | |
<p>JavaFX provides a powerful Java-based UI platform capable of handling large-scale data-driven business applications. | |
JavaFX 2 is a major update to the JavaFX platform. | |
Starting with this version, developers can create JavaFX applications completely in Java. | |
This document describes how to set up a JavaFX-enabled Java platform that | |
will enable you to start developing JavaFX 2 applications in NetBeans IDE.</p> | |
<p class="notes"><b>Notes:</b></p> | |
<ul> | |
<li>If you are using NetBeans IDE 7.1.2, 7.2, or 7.2.1, refer to the <a href="../../72/java/javafx-setup.html">Setting Up NetBeans IDE 7.1.2, 7.2, or 7.2.1 With JavaFX</a> tutorial.</li> | |
<li>If you are using NetBeans IDE 7.4, you do not need to set up an "FX-enabled" Java platform in order to utilize JavaFX support in the IDE. You can develop JavaFX projects in the IDE if you install any standard Java platform that is JDK 7 Update 6 or newer (JDK 7 Update 10 or newer is strongly recommended). See <a href="../../../community/releases/74/relnotes.html#javafx">NetBeans IDE 7.4 Release Notes</a> for details.</li> | |
</ul> | |
<p><b>Contents</b></p> | |
<p><img src="../../../images_www/articles/73/netbeans-stamp.png" class="stamp" | |
alt="Content on this page applies to NetBeans IDE 7.3" | |
title="Content on this page applies to NetBeans IDE 7.3"></p> | |
<ul> | |
<li><a href="#upgrade">Upgrading JavaFX 2</a></li> | |
<li><a href="#create-platform">Creating a JavaFX-Enabled Java Platform</a> | |
<ul> | |
<li><a href="#open-newapp-wiz">Opening the New JavaFX Application Wizard</a></li> | |
<li><a href="#create-platform-manual">Creating a JavaFX-Enabled Platform Manually</a></li> | |
</ul> | |
</li> | |
<li><a href="#tutorials">Tutorials</a></li> | |
<li><a href="#troubleshooting">Troubleshooting</a></li> | |
</ul> | |
<p><b>To follow this tutorial, you need the following software and resources.</b></p> | |
<table> | |
<tbody> | |
<tr> | |
<th width="208" class="tblheader" scope="col">Software or Resource</th> | |
<th width="218" class="tblheader" scope="col">Version Required</th> | |
</tr> | |
<tr> | |
<td class="tbltd1"><a href="http://www.netbeans.org/downloads/index.html" target="_blank">NetBeans IDE</a></td> | |
<td class="tbltd1">7.3</td> | |
</tr> | |
<tr> | |
<td class="tbltd1"><a href="http://www.oracle.com/technetwork/java/javafx/downloads/index.html" target="_blank">Java Development Kit (JDK)</a></td> | |
<td class="tbltd1">7 update 10 or more recent </td> | |
</tr> | |
<tr> | |
<td class="tbltd1"><a href="http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html" target="_blank">JavaFX SDK</a> (cobundled with JDK)</td> | |
<td class="tbltd1">2.2.4 or more recent</td> | |
</tr> | |
</tbody> | |
</table> | |
<p class="notes"><strong>Notes:</strong></p> | |
<ul> | |
<li>Starting with Java SE 7 Update 10, JavaFX SDK is cobundled with the JDK for Windows, Mac OS X, and Linux x86/x64.</li> | |
<li>If you want to continue to use Java SE 6 on Windows, the latest security release, Java SE 6 Update 37, is recommended for JavaFX 2.2.4. For more information, see <a href="http://docs.oracle.com/javafx/2/installation_2-2-4/javafx-installation-windows.htm">JavaFX 2.2.4 Installation for Windows</a>.</li> | |
</ul> | |
<h2 id="upgrade">Upgrading JavaFX 2</h2> | |
<p>If you want to upgrade from one version of JavaFX 2 to another (for example, from JavaFX 2.1 to JavaFX 2.2.x), it is safest to uninstall the older version of JavaFX 2.</p> | |
<p><span class="alert">Manually uninstall the old version and make sure its directories are deleted. The JavaFX installer does not always uninstall older versions of JavaFX 2 correctly, which can lead to the wrong version being used. </span></p> | |
<p>Additionally, you might encounter problems if the new JavaFX SDK location differs from the old location. | |
The existing default JavaFX-enabled platform would still point to the old location. | |
In this case, open Tools > Java Platforms, delete the old default JavaFX-enabled platform and | |
<a href="#create-platform">create a new default JavaFX-enabled platform</a> using the updated version of JavaFX 2.</p> | |
<h2><a name="create-platform"></a>Creating a JavaFX-Enabled Java Platform</h2> | |
<p>NetBeans IDE requires a JavaFX-enabled Java platform in order to use JavaFX 2.2.4. | |
This section describes how to create a JavaFX-enabled Java platform in the IDE.</p> | |
<p>NetBeans IDE attempts to create a JavaFX-enabled Java platform when you choose a JavaFX project in the New Project wizard or when | |
you open an existing JavaFX project for the first time. | |
A warning appears if the IDE cannot create the JavaFX-enabled Java platform automatically. | |
In this case you must create the JavaFX-enabled Java platform manually. | |
You can create additional JavaFX-enabled Java platforms, for example, if you want them to use a different Java JDK.</p> | |
<p>The procedure in this section is divided into the following two parts, to reflect automatic and manual Platform creation.</p> | |
<ul> | |
<li><strong><a href="#open-newapp-wiz">Opening the New JavaFX Application Wizard</a>.</strong> When you open the wizard, the IDE creates a JavaFX-enabled Java platform. </li> | |
<li><strong><a href="#create-platform-manual">Creating a JavaFX-Enabled Platform Manually</a>.</strong> If you want an additional JavaFX-enabled platform, you must create the platform manually.</li> | |
</ul> | |
<div class="indent"> | |
<h3><a name="open-newapp-wiz"></a>Opening the New JavaFX Application Wizard</h3> | |
<p>The first step in creating a JavaFX-enabled Java platform is to open the IDE's New JavaFX Application wizard. | |
(Alternatively, you may open the New JavaFX Preloader wizard.) | |
If the IDE does not find a JavaFX-enabled Java platform, the IDE attempts to generate a JavaFX-enabled Java platform. | |
If the IDE successfully generates a JavaFX-enabled Java platform your setup is complete. | |
If the IDE does not generate a JavaFX-enabled Java platform, you must create a platform manually.</p> | |
<p><strong>To open the New JavaFX Application Wizard:</strong></p> | |
<ol> | |
<li>In the IDE, choose File > New Project or click the New Project icon (<img src="../../../images_www/articles/73/java/javafx-setup/newicon.png" alt="New Project icon">).<br> The New Project wizard opens. <br> | |
<p class="align-center"> | |
<a href="../../../images_www/articles/73/java/javafx-setup/new-project.png" rel="lytebox" | |
title="Flow view with added components"> | |
<img src="../../../images_www/articles/73/java/javafx-setup/new-project-small.png" | |
alt="Flow view with added components" border=1></a></p></li> | |
<li>Select the JavaFX category and select JavaFX Application under Projects. Click Next. | |
<br>The IDE activates the JavaFX 2 feature and generates a JavaFX-enabled Java platform. | |
<p class="align-center"> | |
<a href="../../../images_www/articles/73/java/javafx-setup/newproject-fx.png" rel="lytebox" | |
title="New JavaFX Application wizard showing autogenerated platform"> | |
<img src="../../../images_www/articles/73/java/javafx-setup/newproject-fx-small.png" | |
alt="New JavaFX Application wizard showing autogenerated platform" border=1></a></p> | |
The IDE generates a JavaFX-enabled Java platform. | |
This JavaFX-enabled platform uses the same JDK sources that the IDE uses by default. | |
The name of the generated platform is Default JavaFX Platform. | |
The IDE automatically selects this platform. | |
Your setup is complete, unless you want to create an additional JavaFX-enabled Java platform using a different JDK. | |
You can now do the <a href="#tutorials">Tutorials</a>. | |
If you want to create additional JavaFX-enabled Java platforms, see <a href="#create-platform-manual">Creating a JavaFX-Enabled Platform Manually</a>.<br> | |
</li> | |
</ol> | |
</ul> | |
<h3><a name="create-platform-manual"></a>Creating a JavaFX-Enabled Platform Manually</h3> | |
<p>You need to create a JavaFX-enabled Java platform manually if you want a JavaFX-enabled platform based on a Java JDK other than the JDK that the IDE uses by default. | |
For example, your IDE uses Java JDK 1.6.0 update 37 on Windows, but you want to build JavaFX applications using Java JDK 7 Update 11.</p> | |
<p><strong>To create a JavaFX-enabled platform manually:</strong></p> | |
<ol> | |
<li>Open the NetBeans IDE Java Platform Manager. You can open the Platform Manager in the following ways: | |
<ul> | |
<li>In the New JavaFX Application or New JavaFX Preloader wizard, click Manage Platforms...</li> | |
<li>Expand the Tools menu and select Java Platforms.</li> | |
<li>Open the Project Properties of a Java project. Go to the Libraries page. Click Manage Platforms...</li> | |
</ul> | |
</li> | |
<li>Click Add Platform... to open the Add Java Platform wizard on the Choose Java Platform panel. Specify the location of your desired JDK. | |
<p class="align-center"> | |
<a href="../../../images_www/articles/73/java/javafx-setup/addplatform.png" rel="lytebox" | |
title="Choose Java Platform panel of Add Java Platform wizard, showing available platforms"> | |
<img src="../../../images_www/articles/73/java/javafx-setup/addplatform-small.png" | |
alt="Choose Java Platform panel of Add Java Platform wizard, showing available platforms" border=1></a></p></li> | |
<li>Select a JDK. You must select JDK JDK 7 Update 10 or later (or 1.6 update 37 or later). Click Next. The Platform Name panel opens.<br> | |
<p class="align-center"> | |
<a href="../../../images_www/articles/73/java/javafx-setup/platform-name.png" rel="lytebox" | |
title="Platform Name panel of Add Java Platform wizard"> | |
<img src="../../../images_www/articles/73/java/javafx-setup/platform-name-small.png" | |
alt="Platform Name panel of Add Java Platform wizard" border=1></a></p></li> | |
<li>Give your new platform an arbitrary, descriptive name and click Finish to | |
return to the Platform Manager. You can see that the platform you created is now listed in the left pane. | |
<p class="align-center"> | |
<a href="../../../images_www/articles/73/java/javafx-setup/platform-mgr-newplatform-nofx.png" rel="lytebox" | |
title="Platform Manager showing new platform"> | |
<img src="../../../images_www/articles/73/java/javafx-setup/platform-mgr-newplatform-nofx-small.png" | |
alt="Platform Manager showing new platform" border=1></a></p></li> | |
<li>Select the platform you created. Open the JavaFX tab for that platform. Currently, JavaFX is not enabled for this platform. | |
Select the Enable JavaFX box. | |
<p class="align-center"> | |
<a href="../../../images_www/articles/73/java/javafx-setup/enabled.png" rel="lytebox" | |
title="JavaFX enabled"> | |
<img src="../../../images_www/articles/73/java/javafx-setup/enabled-small.png" | |
alt="JavaFX enabled" border=1></a></p> | |
The JavaFX SDK, JavaFX Javadoc, and JavaFX Runtime fields are now filled in. | |
You do not need anything in the Sources field.</li> | |
<li>Click Close.<br> | |
Your JavaFX-enabled platform is complete. </li> | |
</ol> | |
</div> | |
<h2><a name="tutorials"></a>Tutorials</h2> | |
<p>After you set up NetBeans IDE to use JavaFX 2.2.4, try to do the <a href="http://download.oracle.com/javafx/" target="_blank">JavaFX tutorials</a> as NetBeans projects.</p> | |
<h2><a name="troubleshooting"></a>Troubleshooting</h2> | |
<ul> | |
<li><strong>I get a warning that my JavaFX Runtime is obsolete.</strong> Did you ever install an earlier version of JavaFX 2? The installer might not have uninstalled the old Runtime correctly. | |
<strong>Fix:</strong> Manually uninstall any older version of JavaFX 2. Be sure to delete any directories that remain after uninstalling.</li> | |
<li><strong>I have another problem that you don't describe in this document!</strong> | |
If you think something is missing from this document, click the Send Feedback on This Tutorial link below and let the writers know. | |
If you think you have found a bug in NetBeans IDE support for JavaFX 2, please <a href="https://netbeans.org/community/issues.html">report it</a>. | |
On the enter_bug.cgi page, select the javafx product.</li> | |
</ul> | |
<div class="feedback-box" ><a href="/about/contact_form.html?to=3&subject=Feedback:%20JavaFX%20Setup">Send Feedback on This Tutorial</a></div> | |
<br style="clear:both;" > | |
<p><a href="../../trails/matisse.html">Back to the Learning Trail</a></p> | |
</body> | |
</html> |