Java Reference
In-Depth Information
}
}
2.
After saving the file named HelloWorldMain.java , use the
command-line prompt to navigate to the file.
3.
Compile the source code file HelloWorldMain.java using
the Java compiler javac :
javac -d . HelloWorldMain.java
4.
Run and test your JavaFX Hello World application. Assuming
you are located in the same directory as the Hel-
loWorldMain.java file, type the following command to run
your JavaFX Hello World application from the command-line
prompt:
java
org.java8recipes.chapter14.recipe14_01.HelloWorldMain
Note This class can also be created within an existing JDK 8 application. For in-
stance, the project that contains the sources for this topic contains all of the JavaFX re-
cipes in the org.java8recipes.chapter14 source package. This is possible
since JavaFX no longer requires additional configuration; it is already part of any JDK 8
project.
How It Works
Following are descriptions of the two solutions. Both solutions require JavaFX 8 or
JavaFX 2.x along with JDK 7. Solution 1 demonstrates how to build a JavaFX applica-
tion using the NetBeans IDE. Solution 2 covers the development of a simple JavaFX
application via your favorite text editor, and use of the command-line or terminal to
compile and execute JavaFX programs.
The NetBeans IDE makes it very easy to develop a JavaFX application via a
JavaFX project. In fact, NetBeans provides a template Hello World application after
following the JavaFX project-creation wizard. This is a great solution for beginning
 
Search WWH ::




Custom Search