Java Reference
In-Depth Information
How to do it...
For this recipe, let's assume the following:
F You have an application named "cookbook"
F The root directory for your source code is located in the folder src
F The main class is located in the package , where script file
Main.fx is designated as the entry point of the application
To package this application using JavaFX's packager tool, start a command prompt, and type
the following:
javafxpackager -src src -appClass
Upon completion, this command will generate a dist/ directory where all the files are placed
as shown in the next screenshot.
You will find the code as described for this recipe in ch07/source-code/src/cookbook.
app.Main.fx . The code is immaterial for this recipe; however, it gives you a starting point to
test the javafxpackager .
How it works...
Although the command issued at the prompt is simple, the JavaFX packager tool does several
import tasks when packaging your application including the following:
F Java and JavaFX code compilation —the packager tool provides joint compilation
services where it compiles Java source files and JavaFX script source files. It
automatically resolves all interdependencies that may exist in the code structure
between Java code and JavaFX code. In our scenario, all compilable code will be
built into Java classes and placed in a temporary location during the build process
to be assembled into a JAR file.
F Assemble resources —copies all non-compilable resources (that is, media files, fonts,
and so on), that are on the source path (or explicitly specified using a build switch),
for packaging. In the example, all resources found in the source path will be copied
to a temporary build location until they are assembled as a JAR file.
F Assemble JAR —this step assembles the compiled class files and the media resources
into the application's executable JAR file. For our example, the build process assembles
all compiled resources and non-compiled resources into the Main.jar file.
Search WWH ::

Custom Search