javafxc - JavaFX Compiler Utility


javafxc - JavaFX Compiler Utility


javafxc [options] [sourcefiles] [@argfiles]

Command-line options.
One or more source files to be compiled (such as MyModule.fx).
One or more files that list options and source files. The -J options are not allowed in these files.


The javafxc tool reads JavaFX Script source files and compiles them into JVM bytecode class files. You can pass source code file names to javafxc in two ways:

Each source code file must have an .fx suffix. It is compiled into a module class file with the same root name and a .class suffix. For example, a module called MyModule will be written in a source file called MyModule.fx and compiled into a module file called MyModule.class. Module files are Java platform class files, just like class files created with the Java programming language.

Class definitions produce additional class files. These class files have names combining the module and class names, such as MyModule$MyClass.class.

You should arrange source files in a directory tree that reflects their package tree. For example, if you keep all your source files in /workspace, the source code for com.mysoft.mypack.MyModule should be in /workspace/com/mysoft/mypack/MyModule.fx.

By default, the compiler puts each class file in the same directory as its source file. You can specify a separate destination directory with the -d option. For more information, see Options.


The compiler has a set of standard options that are supported on the current development environment. An additional set of nonstandard options are specific to the current virtual machine and compiler implementations. Non-standard options begin with -X.

Standard Options

-cp path
-classpath path
Specify where to find user class files and (optionally) source files. This classpath declaration overrides the user classpath declaration in the CLASSPATH environment variable. If neither CLASSPATH, -cp nor -classpath is specified, the user classpath consists of the current directory. If the -sourcepath option is not specified, the user classpath is also searched for source files.

Note: The directory specified by -d is not automatically added to your user classpath.
-d directory
Specify where to place generated class files.
Show a description of each use or override of a deprecated member or class. Without -deprecation, javafxc shows a summary of the source files that use or override deprecated members or classes. -deprecation is shorthand for -Xlint:deprecation.
-encoding encoding
Set the source file encoding name, such as EUC-JP and UTF-8. If -encoding is not specified, the platform default converter is used.
-endorseddirs directories
Override location of endorsed standards path.
Generate all debugging information, including local variables. By default, only line number and source file information is generated.
Do not generate any debugging information.
Generate only some kinds of debugging information, specified by a comma-separated list of keywords. Valid keywords are:
Line number debugging information
Local variable debugging information
Source file debugging information
Print a synopsis of standard options.
-implicit: {class,none}
Control the generation of class files for implicitly loaded source files. To automatically generate class files, use -implicit:class. To suppress class file generation, use -implicit:none. If this option is not specified, the default is to automatically generate class files. See Searching For Types.
Disable warning messages. This has the same meaning as -Xlint:none.
-sourcepath sourcepath
Specify the source code path to search for class or interface definitions. As with the user class path, source path entries are separated by colons (:) and can be directories, JAR archives, or ZIP archives. If packages are used, the local path name within the directory or archive must reflect the package name. See Searching For Types.

Note: Classes found through the classpath might be subject to automatic recompilation if their sources are also found.
-platform platform
Specify platform translator plug-in.
-profile [desktop | mobile | tv]
Specify the JavaFX platform. The JavaFX SDK supports desktop, mobile, tv and defaults to desktop. Internally the -profile option specifies the configuration file, which is used for setting environment variables.
Verbose output. This output includes information about each class loaded and each source file compiled.
Display information about non-standard options and exit.

Cross-Compilation Options

By default, classes are compiled against the bootstrap and extension classes of the platform that javafxc shipped with. But javafxc also supports cross-compiling, where classes are compiled against a bootstrap and extension classes of a different JavaFX platform implementation. It is important to use -bootclasspath and -extdirs when cross-compiling.

-target version
Generate class files that target a specified version of the VM. Class files will run on the specified target and on later versions, but not on earlier versions of the VM. Valid targets are 1.1, 1.2, 1.3, 1.4, 1.5 (also 5) and 1.6 (also 6).
-bootclasspath bootclasspath
Cross-compile against the specified set of boot classes. As with the user-defined CLASSPATH variable, bootclasspath entries are separated by colons (:) and can be directories, JAR archives, or ZIP archives.
-extdirs directories
Cross-compile against the specified extension directories. Directories is a colon-separated list of directories. Each JAR archive in the specified directories is searched for class files.
Displays the tool version and exists. Note: Use -J-version to get the Java platform version.

Nonstandard Options

Prepend to the bootstrap classpath.
Append to the bootstrap classpath.
Override location of bootstrap class files.
Enable all recommended warnings. In this release, all available warnings are recommended.
Disable all lint warnings.
-Xmaxerrors number
Set the maximum number of errors to print.
-Xmaxwarns number
Set the maximum number of warnings to print.
-Xstdout filename
Send compiler messages to the named file. By default, compiler messages go to System.err.
Specify which file to read when both a source file and class file are found for a type. (See Searching For Types). If -Xprefer:newer is used, it reads the newer of the source or class file for a type (default). If the -Xprefer:source option is used, it reads the source file.

-J Option

-J option
Pass an option to the java launcher called by javafxc. For example, -J-Xms48m sets the startup memory to 48 megabytes. Although it does not begin with -X, it is not a `standard option' of javac.

Note: The CLASSPATH, -classpath, -bootclasspath, and -extdirs options do not specify the classes used to run javafxc. Modifying the compiler implementation in this way is always risky. If you do need to do this, use the -J option to pass through options to the underlying java launcher.

Command-Line Argument Files

To shorten or simplify the javac command line, you can specify one or more files that themselves contain arguments to the javafxc command (except -J options). This enables you to create javafxc commands of any length on any operating system.

An argument file can include javafxc options and source filenames in any combination. The arguments within a file can be space-separated or newline-separated. If a file name contains embedded spaces, put the whole file name in double quotes.

File names within an argument file are relative to the current directory, not the location of the argument file. Wildcards (*) are not allowed in these lists (such as for specifying *.java). Use of the '@' character to recursively interpret files is not supported. The -J options are not supported because they are passed to the launcher, which does not support argument files.

When executing the javac utility, pass in the path and name of each argument file with the '@' leading character. When javac encounters an argument beginning with the character `@', it expands the contents of that file into the argument list.

When compiling a source file, the compiler often needs information about a type whose definition did not appear in the source files given on the command line. The compiler needs type information for every class or interface used, extended, or implemented in the source file. This includes classes and interfaces not explicitly mentioned in the source file but which provide information through inheritance.

For example, when you create a javafx.gui.Button subclass, you are also using Button's ancestor classes: javafx.gui.AbstractButton, javafx.gui.Component, javafx.gui.ClusterElement and java.lang.Object.

When the compiler needs type information, it looks for a source file or class file that defines the type. The compiler searches for class files first in the bootstrap and extension classes, then in the user class path (which by default is the current directory). The user classpath is defined by setting the CLASSPATH environment variable or by using the -classpath command line option.

If you set the -sourcepath option, the compiler searches the indicated path for source files. Otherwise the compiler searches the user classpath for both class files and source files.

You can specify different bootstrap or extension classes with the -bootclasspath and -extdirs options.

A successful type search might produce a class file, a source file, or both. If both file types are found, you can use the -Xprefer option to instruct the compiler which to use. If newer is specified, the compiler will use the newer of the two files. If source is specified, it will use the source file. The default is newer.

If a type search finds a source file for a required type, either by itself or as a result of the setting for -Xprefer, the compiler will read the source file to get the information it needs. In addition, it will by default compile the source file as well. You can use the -implicit option to specify the behavior. If none is specified, no class files are generated for the source file. If class is specified, class files are generated for the source file. - all specs in one place