Java Reference
In-Depth Information
In addition to demonstrating how to dynamically load images over the Internet, this example shows you how
to use animation in JavaFX. Now it's time for you to compile and run the program. We show you two ways to do this:
from the command line and using NetBeans.
Compiling and Running from the Command Line
We usually use an IDE to build and run JavaFX programs, but to take all of the mystery out of the process we use the
command-line tools first.
For this exercise, as with most others in the topic, you need the source code. if you prefer not to type the
source code into a text editor, you can obtain the source code for all of the examples in this topic from the code download
site. See the resources section at the end of this chapter for the location of this site.
Note
Assuming that you've downloaded and extracted the source code for this topic into a directory, follow the
directions in this exercise, performing all of the steps as instructed. We dissect the source code after the exercise.
COMpILING aND rUNNING the heLLO earthrISe prOGraM FrOM
the COMMaND LINe
You'll use the javac and java command-line tools to compile and run the program in this exercise. From the
command-line prompt on your machine:
1.
navigate to the Chapter01/Hello directory.
2.
execute the following command to compile the HelloEarthRiseMain.java file.
javac -d . HelloEarthRiseMain.java
3.
Because the -d option was used in this command, the class files generated are placed
in directories matching the package statements in the source files. the roots of those
directories are specified by the argument given for the -d option, in this case the current
directory.
4.
to run the program, execute the following command. note that we use the fully qualified
name of the class that will be executed, which entails specifying the nodes of the path name
and the name of the class, all separated by periods.
java projavafx.helloearthrise.ui.HelloEarthRiseMain
the program should appear as shown in Figure 1-4 earlier, with the text scrolling slowly upward, reminiscent of
the Star Wars opening crawls.
Congratulations on completing your first exercise as you explore JavaFX!
 
 
Search WWH ::




Custom Search