Appendix C
JavaFX Command-Line Arguments

Throughout this book you’ve relied on the NetBeans IDE to run and compile your JavaFX scripts and applications. This is a convenient way to develop and is by far the most common. Most graphics-based open-system developers choose to use a graphics-based IDE to develop their products.

JavaFX, like most Java-based products, also comes with two powerful command-line utilities that can be used for compiling and executing your scripts. This appendix serves as a reference for some of the capabilities of the JavaFX command-line utilities.

The two main javafx command-line utilities, and their uses, are listed here:

javafx      :used to execute javafx applications from the command line
javafxc     :used to compile javafx scripts from the command line

The following sections explain the uses of these utilities. Refer to these sections as needed to help you with your command-line functions. The first section quickly describes the environment you must have in place before you can use the JavaFX command-line utilities.

Command-Line Environment

If you have followed this book from the beginning and have successfully installed JavaFX, then chances are your machine is already correctly configured for using the command-line utilities. The command-line utilities are installed at the same time as JavaFX. In fact, NetBeans and Eclipse use the same command-line utilities you will be using here.

If you have not followed this book from the beginning and are not sure if your environment is set up to use the command-line utilities, follow these steps:

1. Install JavaFX if you have not already done so. It should go without saying that you need to install JavaFX before you can use any of the JavaFX command-line utilities. Chances are that the installation of JavaFX will take care of setting up your environment variables.

2. Check your Path statement. The JavaFX command-line utilities require that you have a correctly established Path statement. To check it, type path in a command window. You should see something similar to this:

  C:>path
  PATH=C:Program FilesJavaFXjavafx-sdk1.3in;C:Program Files
  JavaFXjavafx-sdk1.3emulatorin;c:program filesjavajdk1.6.0_13in;

The following path is what you are looking for to ensure your environment is set up to run the javafx command-line utilities:

  C:Program FilesJavaFXjavafx-sdk1.3in;

NOTE

This path assumes you installed JavaFX in its default location. If you chose a different location in which to install JavaFX, the path should point to that location.

NOTE

All the command-line utilities are in the bin folder of the javafx install path.

3. If your path statement does not include the path to the javafx bin folder, you will need to add it. The command to add a path statement looks like this:

  C:> set path=C:Program FilesJavaFXjavafx-sdk1.3in; %PATH%

NOTE

The %PATH% at the end of the set path command tells your system to insert whatever paths are already in your path variable after the new line. If you do not include this, all your existing paths will be replaced by the new one.

With your environment set up correctly, you can now move on to using the command-line utilities.

javafxc

The javafxc command-line utility is used to compile JavaFX scripts into executable applications. The only required parameter needed to run the javafxc utility is the name of the script file to compile. The following example compiles a file named HelloWorld.fx:

NOTE

You can use the HelloWorld file you created in Chapter 3 if you need a file to help you with this example.

C:>javafxc HelloWorld.fx

This simple command compiles your script file. Even though only one required parameter is needed to compile a file, you can pass several options into the javafxc utility. These options are listed and explained next.

Parameter:

-g

Explanation:
Generate all debugging info

Example:

C:>javafxc –g HelloWorld.fx

Parameter:

  -g:none

Explanation:
Generate no debugging info

Example:

C:>javafxc –g:none HelloWorld.fx

Parameter:

  -g:{lines, vars, source}

Explanation:
Generate only some debugging info

Example:

C:>javafxc –g:{33,34,35,36} HelloWorld.fx

Parameter:

  -nowarn

Explanation:
Generate no warnings

Example:

C:>javafxc –nowarn HelloWorld.fx

Parameter:

  -verbose

Explanation:
Output messages about what the compiler is doing

Example:

C:>javafxc –verbose HelloWorld.fx

Parameter:

  -deprecation

Explanation:
Output source locations where deprecated APIs are used

Example:

C:>javafxc –deprecation HelloWorld.fx

Parameter:

  -classpath

Explanation:
Specify where to find user class files

Example:

C:>javafxc –classpath "C:MyClasses" HelloWorld.fx

Parameter:

-cp

Explanation:
Specify where to find user class files

Example:

C:>javafxc –cp "C:MyClasses" HelloWorld.fx

Parameter:

-sourcepath

Explanation:
Specify where to find input source files

Example:

C:>javafxc –sourcepath "C:MySource" HelloWorld.fx

Parameter:

  -bootclasspath

Explanation:
Override the location of bootstrap class files

Example:

C:>javafxc -bootclasspath "C:MyClasses" HelloWorld.fx

Parameter:

   -extdirs

Explanation:
Override the location of installed extensions

Example:

C:>javafxc –extdirs "C:MyExtensions" HelloWorld.fx

Parameter:

  -endorseddirs

Explanation:
Override the location of the endorsed standards path

Example:

C:>javafxc –endorseddirs "C:MyStandards" HelloWorld.fx

Parameter:

    -d

Explanation:
Specify where to place generated class files

Example:

C:>javafxc –d "C:MyFinalBuild" HelloWorld.fx

Parameter:

   -implicit:

Explanation:
Specify whether or not to generate class files for implicitly referenced files

Example:

C:>javafxc –implicit:none HelloWorld.fx

Parameter:

  -encoding

Explanation:
Specify character encoding used by source files

Example:

C:>javafxc –encoding "UTF-8" HelloWorld.fx

Parameter:

   -target

Explanation:
Generate class files for a specific VM version

Example:

C:>javafxc –target "1.5" HelloWorld.fx

Parameter:

   -platform

Explanation:
Platform translator plug-in

Example:

C:>javafxc –platform "active" HelloWorld.fx

Parameter:

   -version

Explanation:
Version information

Example:

C:>javafxc –version

Parameter:

-help

Explanation:
Print a synopsis of standard options

Example:

C:>javafxc –help

Parameter:

  -X

Explanation:
Print a synopsis of non-standard options

Example:

C:>javafxc -X

javafx

The javafx command-line utility is used to execute already compiled JavaFX applications. Like the javafxc utility, javafx can take a number of optional parameters.

NOTE

The javafx command-line utility can execute either a .class file or a .jar file. In the following examples, we use .class.

Parameter:

    -d32

Explanation:
Use a 32-bit data model if available

Example:

C:>javafx –d32 HelloWorld

Parameter:

      -d64

Explanation:
Use a 64-bit data model if available

Example:

C:>javafx –d64 HelloWorld

Parameter:

    -client

Explanation:
Select the “client” VM if available

Example:

C:>javafx –client HelloWorld

Parameter:

    -server

Explanation:
Select the “server” VM if available

Example:

C:>javafx –server HelloWorld

Parameter:

    -cp

Explanation:
Class search path of directories and ZIP/JAR files

Example:

C:>javafx –cp "C:MyClasses" HelloWorld

Parameter:

    -classpath

Explanation:
Class search path of directories and ZIP/JAR files

Example:

C:>javafx –classpath "C:MyClasses" HelloWorld

Parameter:

    -D

Explanation:
Set a system property

Example:

C:>javafx –D HelloWorld.property = "value" HelloWorld

Parameter:

    -verbose

Explanation:
Enable verbose output

Example:

C:>javafx –verbose HelloWorld

Parameter:

    -version

Explanation:
Print the product version and exit

Example:

C:>javafx -version

Parameter:

    -version:<value>

Explanation:
Require the specified JRE version to run

Example:

C:>javafx –version:1.3 HelloWorld

Parameter:

    -showversion

Explanation:
Print the product version and continue

Example:

C:>javafx –showversion

Parameter:

    -jre-restrict-search | -jre-no-restrict-search

Explanation:
Include/exclude user private JREs in the version search

Example:

C:>javafx –jre-restrict-search HelloWorld

Parameter:

    -? -help

Explanation:
Print help options

Example:

C:>javafx -?

Parameter:

    -X

Explanation:
Print help on non-standard options

Example:

C:>javafx –X

Parameter:

    -ea

Explanation:
Enable assertions with the specified granularity

Example:

C:>javafx –ea:com.test.package HelloWorld

Parameter:

    -enableassertions

Explanation:
Enable assertions with the specified granularity

Example:

C:>javafx –enableassertions:com.test.package HelloWorld

Parameter:

    -da

Explanation:
Disable assertions with the specified granularity

Example:

C:>javafx –da:com.test.package HelloWorld

Parameter:

    -disableassertions

Explanation:
Disable assertions with the specified granularity

Example:

C:>javafx –disableassertions:com.test.package HelloWorld

Parameter:

    -esa | -enablesystemassertions

Explanation:
Enable system assertions

Example:

C:>javafx –esa HelloWorld

Parameter:

    -dsa | -disablesystemassertions

Explanation:
Disable system assertions

Example:

C:>javafx –dsa HelloWorld

Parameter:

    -agentlib

Explanation:
Load the native agent library

Example:

C:>javafx –agentlib:hprof HelloWorld

Parameter:

    -agentpath

Explanation:
Load the native agent library by full pathname

Example:

C:>javafx –agentpath:C:MyAgentPath HelloWorld

Parameter:

    -splash

Explanation:
Show the splash screen with the specified image

Example:

C:>javafx –splash:Myslash.png HelloWorld
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.223.170.223