As of JDK 8u451, JavaFX is no longer included as part of Java SE 8. Please visit https://www.oracle.com/javase/javafx for more information.
The following items comprise the main JavaFX Ant tasks:
Used to convert CSS files to binary format for faster processing. See also Section 5.4, "Style Sheet Conversion."
Used to assemble the application package for redistribution. By default, the deploy task will generate the base application package, but it can also generate self-contained application packages if requested. See also Section 5.7, "Run the Deploy Task or Command."
Used to create one or more application JAR files. See also Section 5.5, "Create the Main Application JAR File."
Used when the application needs a digital signature. See also Section 5.6, "Sign the JAR Files."
Items are in alphabetical order.
<fx:csstobin> DescriptionConverts a set of CSS files into binary form (BSS).
ParametersTable 10-1 fx:csstobin
Attribute Description Type Required?outdir
Name of the directory in which output files are generated.
String
Yes
This example converts all CSS files in the output tree to binary form.
<fx:csstobin outdir="build/classes"> <fileset dir="build/classes" includes="**/*.css"/> </fx:csstobin>
Generates a package for both web deployment and standalone applications. The package includes a set of JAR files, a JNLP file, and an HTML file.
ParametersTable 10-2 fx:deploy
Attribute Description Type Required?embeddedHeight
If present, this value will be used for Javascript/HMTL code instead of width/height. Affects only embedded deployment mode.
Use it if you want to specify a relative dimension for an embedded application.
See Section 5.8.4, "Publishing an Application that Fills the Browser Window."
String
No
embeddedWidth
Same description as for embeddedHeight
.
String
No
embedjnlp
If true, embed the JNLP descriptor into the web page. Reduces number of network connections to be made on startup and helps to improve startup time.
Boolean
No
Default is false
.
extension
Treat the files named in srcfiles
as extensions. If present, only a portion of the deployment descriptor is generated, and the HTML file is not generated.
Boolean
No
Default is false
.
height
Height of the application scene, for embedding applications into a web page.
String
Yes
includeDT
If set to true
, files related to the Deployment Toolkit will be copied to a web-files
subdirectory of the directory specified in outdir
. This setting is useful for offline development but is not advised for production.
Boolean
No
Default is false
.
nativeBundles
Values:
all
deb
dmg
exe
image
installer
mac.appStore
msi
none
pkg
rpm
Value all
produces all applicable self-contained application packages. Value installer
produces only installable packages, not a disk image. Value none
produces no self-contained application packages. Or use another value to produce a specific package installer.
String
No
Default is none
.
offlineAllowed
If the value is true
, the cached application can operate even if the client system is disconnected from the network.
Boolean
Default is true
.
outdir
Name of the directory in which output files are generated.
String
Yes
outfile
Prefix of the output files, without the extension.
String
Yes
placeholderref
Placeholder in the web page where the application will be embedded. This is expected to be JavaScript DOM object.
String
Yes
Either reference or ID of placeholder is required.
placeholderid
Used with callbacks. The ID of the placeholder in the web page where application will be embedded. The JavaScript function document.getElementById()
is used to resolve it.
String
Yes
Either the reference or the ID of the placeholder is required.
signBundle
Used for self-contained applications to request that the bundler sign the bundle that is generated. This attribute is ignored by bundlers that do not support signing. At the time of the 8u40 release of the JDK, only OS X bundlers support signing.
Boolean
Default depends on the bundler used.
updatemode
Indicates the preferences for when checks for application updates are performed for embedded and Web Start applications.
A value of always
means to always check for updates before launching the application.
A value of background
means to launch the application while checking for updates in the background.
See Section 5.9.1, "Background Update Check for the Application."
String
No
Default is background
.
width
Width of the application scene, for embedding applications into a web page.
String
Yes
This is a simple example of an <fx:deploy>
Ant task. It generates an HTML file and JNLP file into the web-dist directory and uses "Fish"
as the prefix for the generated files.
<fx:deploy width="600" height="400" outdir="web-dist" outfile="Fish" offlineAllowed="false"> <fx:info title="Sample application"/> <fx:application refid="myapp"/> <fx:resources refid="myresources"/> </fx:deploy>
The following Ant task creates a redistributable package for a simple application with a preloader. Details about the application and its resources are defined in the <fx:application>
and <resource>
elements in the task.
Note that the location of the output package is defined by the outdir
attribute of the <fx:deploy>
task. New files are generated using the name
prefix specified in the outfile
attribute. As a result of execution of this task, the following files are created in the web-dist folder:
preloader.jar
helloworld.jar
App.jnlp
App.html
Note:
By default, the deployment package uses auxiliary files from java.com to support web deployment. This is the preferred way, because it enables the application to always use the best way to deploy on the web. However, if you want to test your application in a closed network then you can include these files into your application package. To do this, passincludeDT="true"
as an attribute in the <fx:deploy>
Ant task.
<fx:deploy width="600" height="400" outdir="web-dist" outfile="App"> <fx:info title="Sample application"/> <fx:application name="SampleApp" mainClass="testapp.MainApp" preloaderClass="testpreloader.Preloader"> <fx:param name="testVariable" value="10"/> </fx:application> <fx:resources> <fx:fileset requiredFor="preloader" dir="dist"> <include name="preloader.jar"/> </fx:fileset> <fx:fileset dir="dist"> <include name="helloworld.jar"/> </fx:fileset> </fx:resources> </fx:deploy>
This example creates a package for a self-contained application that contains a secondary launcher that can be used to start the application in a memory-constrained environment. The main launcher does not set JVM options. The secondary launcher passes an option to limit the amount of memory used.
<fx:deploy outdir="../samples/test/ant" nativeBundles="image"> <fx:application name="Secondary Launcher Sample" mainClass="hello.Test"/> <fx:resources> <fx:fileset dir="../samples/test/resources" includes="mainApp.jar"/> </fx:resources> <fx:info title="Secondary Launcher Test"/> <fx:secondaryLauncher mainClass="hello.Test" name="Standard Launch"/> <fx:secondaryLauncher name="Memory Constrained"> <fx:jvmarg="-xmx64m"/> </fx:secondaryLauncher> </fx:deploy>
Packages a JavaFX application into a JAR file. The set of files to be included is defined by nested <fx:fileset>
parameters. The <fx:jar>
task also embeds a JAR manifest into the JAR file.
In addition to creating a JAR archive, this task also:
Embeds the JavaFX launcher, which detects the presence of JavaFX Runtime, sets up the environment, and executes the application.
Embeds the fallback AWT applet, to be used if JavaFX is not available.
Creates a manifest in the JAR file.
The resulting JAR file supports launching by double-clicking.
ParametersTable 10-3 fx:jar
Attribute Description Type Required?destfile
Path to output JAR file (location and name)
String
Yes
See Example 10-3 and the following example.
This example shows how to use the <fx:jar>
Ant task to create the main application JAR file for a simple application without a custom preloader. The resulting JAR file performs the following two actions:
Starts test.MyApplication with all resources needed on the classpath when launched as java -jar application.jar
or by double-clicking the JAR file.
Automatically detects the location of JavaFX Runtime and prompts the user to install it if it is not available, or reports if the platform is not supported.
<!-- Expect definition of JavaFX ant tasks is already imported --> <fx:jar destfile="dist/application.jar"> <!-- Details about application --> <fx:application name="Sample JavaFX application" mainClass="test.MyApplication"/> <!-- Define what auxilary resources are needed --> <fx:resources> <fx:fileset dir="dist" includes="lib/*.jar"/> </fx:resources> <!-- What to include into result jar file? Everything in the build tree --> <fileset dir="build/classes"/> <!-- Customize jar manifest (optional) --> <manifest> <attribute name="Implementation-Vendor" value="Samples Team"/> <attribute name="Implementation-Version" value="1.0"/> </manifest> </fx:jar>
Digitally signs an application JAR file with a certificate.
Signs the JAR file as BLOB. In other words, instead of every entry being signed separately, the JAR file is signed as a single binary object.
This is a new signing method in JavaFX. For traditional signing, the standard Ant signjar
task should be used.
Table 10-4 fx:signjar
Attribute Description Type Required?alias
The alias for the key
String
Yes
destdir
Location of output file
String
Yes
keypass
Password for the private key
String
Yes
keystore
Keystore file name
File
Yes
jar
The JAR file to sign*
String
No
Either this attribute or a nested <fx:fileset>
element is required.
storepass
Password to check integrity of the keystore or unlock the keystore
String
Yes
storetype
Keystore type
String
No
Default is jks
.
verbose
Enable verbose output.
Boolean
No
Default is false
.
*Note that:
<fx:signjar jar="path/to/jar/folder/jarname" .../>
is simply a convenience syntax for the following:
<fx:signjar ...> <fileset dir="path/to/jar/folder" file="jarname"/> </fx:signjar><fx:signjar> Usage Examples
The following snippet of Ant code shows how to sign JAR files using the new sign as BLOB technique.
<fx:signjar destdir="dist" keyStore="sampleKeystore.jks" storePass="****" alias="javafx" keyPass="****"> <fileset dir='dist/*.jar'/> </fx:signjar>
Helper parameters are types that are used by the JavaFX tasks described in JavaFX Ant Task Reference. This reference page contains the following elements:
Items are in alphabetical order.
<fx:application> DescriptionBasic application descriptor. It defines the main components and default set of parameters of the application.
ParametersTable 10-5 fx:application
Attribute Description Type Required?daemon
Indicates if the application is installed as a daemon or a service.
Boolean
No
Default value is false
.
fallbackClass
AWT-based applet to be used if application fails to launch due to missing FX runtime and installation of JavaFX is not possible.
String
No
id
Application ID that can be used to get a JavaScript reference to the application in HTML. The same ID can be used to refer to an application object in the Ant task (using refid
).
String
No
mainClass
Qualified name of the main application class, which should extend javafx.application.Application
String
Yes
name
Short name of the application. For self-contained applications, also defines the name of the output package.
String
No
Default value is derived from the main application class.
preloaderClass
Qualified name of the preloader class, which should extend javafx.application.Preloader
String
No
Default is the preloader that is shipped with the JavaFX Runtime.
refid
*
--
Reference
No
toolkit
Indicates your preference for the application to use a specific UI toolkit. Possible values:
fx
swing
String
No
Default value is fx
.
version
Version of the application being packaged.
String
No
Default value is 1.0.
* If refid
is used, then none of the other parameters can be specified.
An unnamed argument that is inserted in the <fx:argument>
element in the deployment descriptor. Multiple arguments are added to the list of arguments in the same order as they are listed in the Ant script.
None.
<fx:argument> Usage Examples<fx:application name="Sample app" mainClass="test.MyApplication"> <!-- unnamed arguments --> <fx:argument>Something</fx:argument> <!-- value with spaces that are generated at build time --> <fx:argument>JRE version: ${java.version}</fx:argument> <!-- example of value using a special character --> <fx:argument>true & false</fx:argument> </fx:application>
Associates file extensions or MIME types with a self-contained application. Multiple instances of this element are supported.
ParametersTable 10-6 <fx:association>
Attribute Description Type Required?description
Description of the types of tiles that are associated with the application. If no description is provided, then application-name File
is used.
String
No
extension
One or more file extensions to associate with the application. Separate values with a space, for example, aaa bbb ccc
. Wild card symbols are not allowed.
String
Depends on the bundlerFoot1
mimetype
MIME type of the files to associate with the application. Wild card symbols are not allowed. Only one value is allowed on Windows, multiple values separated by a space can be provided for Linux or OS X.
String
Depends on the bundlerFoot2
icon
Name of the file that contains the icon for files associated with this application. For Windows the icon format must be .ico
, for Linux the format must be .png
, for OS X the format must be .icns
. If no file name is provided, then the icon for the application is used.
String
No
Footnote1Required on Windows. Either extension
or mimetype
must be provided on OS X.
Footnote2Required on Linux. Either extension
or mimetype
must be provided on OS X.
None.
<fx:association> Usage ExampleThis example associates a self-contained application on Windows with files that have the file extension .aaa
or .bbb
. and provides a description and icon.
<fx:info title="Association example"> <fx:association extension="aaa bbb" description="MyApp Data Files" icon="MyApp.ico"> </fx:association> </fx:info>
Specifies an argument for the bundler that is used to create self-contained applications. Each type of bundler has its own set of arguments.
ParametersTable 10-7 fx:bundleArgument
Attribute Description Type Required?arg
Name of bundler argument
String
Yes
value
Value of bundler argument
String
Yes
Each type of bundler (OS X, Linux, and Windows) has its own set of arguments.
General Bundler ArgumentsID of a <fx:preferences> element to check for JVM options that the user can override.
The path to the default icon to use for launchers and other assists. The file format is .icns
.
Prefix that is applied to the signed binary when binaries that lack property list files (plists, which use the extension .plist
) or existing signatures are found inside the bundles.
Category for the application. The category must be in the list of categories found on the Apple Developer website.
Value stored in the info.plist
file for CFBundleIdentifier
. This value must be globally unique and contain only letters, numbers, dots, and dashes. Reverse DNS order is recommended, for example, com.example.application.my-application
.
Name of the application as it appears on the Mac Menu Bar. A name of less than 16 characters is recommended. The default is the name
attribute of the <fx:application> element.
Version number for the application, used internally. The value must be at least one integer and no more than three integers separated by periods (.) for example, 1.3 or 2.0.1. The value can be different than the value for the version
attribute of the <fx:application>
element. If the version
attribute is specified with a valid value and the mac.CFBundleVersion
argument is not specified, then the value for the version
attribute is used. If neither value is specified, 100 is used as the version number.
Name of the signing key used for Developer ID or Gatekeeper signing. If you imported a standard key from the Apple Developer Website, then that key is used by default. If no key can be identified, then the application is not signed.
Version number for the application, used internally. The value must be at least one integer and no more than three integers separated by periods (.) for example, 1.3 or 2.0.1. The value can be different than the value for the version
attribute of the <fx:application>
element. If the version
attribute is specified with a valid value and the mac.CFBundleVersion
argument is not specified, then the value for the version
attribute is used. If neither value is specified, 100 is used as the version number.
Flag that indicates if DMG customization steps that depend on executing AppleScript code are skipped. Set to true
to skip the steps. When set to true
, the disk window does not have a background image, and the icons are not moved into place. If the systemWide
argument is also set to true
, then a symbolic link to the root Applications folder is added to the DMG file. If the systemWide
argument is set to false
, then only the application is added to the DMG file, no link to the desktop is added.
Version number for the application, used internally. The value must be at least one integer and no more than three integers separated by periods (.) for example, 1.3 or 2.0.1. The value can be different than the value for the version
attribute of the <fx:application>
element. If the version
attribute is specified with a valid value and the mac.CFBundleVersion
argument is not specified, then the value for the version
attribute is used. If neither value is specified, 100 is used as the version number.
Name of the signing key used for Developer ID or Gatekeeper signing. If you imported a standard key from the Apple Developer Website, then that key is used by default. If no key can be identified, then the application is not signed.
Location of the file that contains the entitlements that the application operates under. The file must be in the format specified by Apple. The path to the file can be specified in absolute terms, or relative to your Ant file. If no entitlements are specified, then the application operates in a sandbox that is stricter than the typical applet sandbox, and access to network sockets and all files is prevented.
Version number for the application, used internally. The value must be at least one integer and no more than three integers separated by periods (.) for example, 1.3 or 2.0.1. The value can be different than the value for the version
attribute of the <fx:application>
element. If the version
attribute is specified with a valid value and the mac.CFBundleVersion
argument is not specified, then the value for the version
attribute is used. If neither value is specified, 100 is used as the version number. If this version is an upgrade for an existing application, the value must be greater than the previous version number.
Name of the application signing key for the Mac App Store. If you imported a standard key from the Apple Developer Website, then that key is used by default. If no key can be identified, then the application is not signed.
Name of the installer signing key for the Mac App Store. If you imported a standard key from the Apple Developer Website, then that key is used by default. If no key can be identified, then the application is not signed.
The path of the default icon to use for launchers and other assists. The file format is .png
.
Name of the RPM or DEB package to create.
The path of the default icon to use for launchers and other assists. The file format is .ico
.
Menu group in which to install the application when the menu
attribute of the <fx:preferences> element is true
. This argument is ignored when menu
is false
.
The following example specifies that the generated Windows Installer Package (MSI file) create a Start Menu shortcut in a menu group named Sample Applications. Note that you must specify that the bundler create an MSI file with the nativeBundles
attribute of the <fx:deploy> element.
<fx:deploy outdir="." outfile="helloworld" nativeBundles="msi"> <fx:platform basedir="${JAVA_HOME}"/> <fx:application refId="HelloWorldID"/> <fx:resources refid="appRes"/> <fx:info title="Hello World Example" vendor="Oracle Corporation"/> <fx:bundleArgument arg="win.menuGroup" value="Sample Applications"/> </fx:deploy><fx:callback> Description
Defines a JavaScript callback that can be used to customize user experience.
ParametersTable 10-8 fx:callback
Attribute Description Type Required?name
Name of the event for callback.
String
Yes
refid
*
--
Reference
No
* If refid
is used, then none of the other parameters can be specified.
<TEXT>
<fx:callback> Usage ExamplesIn this example, a callback is used to create an HTML splash screen for an application embedded in a web page. When the event onGetSplash
is triggered, the JavaScript function customGetSplash
is executed.
<fx:callbacks> <fx:callback name="onGetSplash">customGetSplash</fx:callback> </fx:callbacks>
In this example, the callback is defined with JavaScript code in the <fx:callback>
element itself.
<fx:callbacks> <fx:callback name="onLoadHandler"> function () {perfLog(0, "onLoad called");} </fx:callback> </fx:callbacks>
<fx:callbacks> <fx:callback name="onJavascriptReady">callAppFunction</fx:callback> <fx:callback name="onGetSplash">function(id) {}</fx:callback> </fx:callbacks>
Collection of JavaScript callbacks to be used to customize the user experience.
ParametersTable 10-9 fx:callbacks
Attribute Description Type Required?refid
*
--
Reference
No
* If refid
is used, then none of the other parameters can be specified.
See the examples for <fx:callback>.
<fx:fileset> DescriptionExtension of the standard Ant FileSet
type, which provides the means to specify optional meta information on a selected set of files. This includes:
Type of resource (see the type
attribute)
Operating system and architecture for which this resource is applicable
When this resource is needed, which helps to optimize loading order
Depending on type, the resource might not be used by the enclosing task. See Section 5.7.2, "Application Resources" for details.
A fileset of type "jar"
is expected to contain a set of JAR files to be added to the classpath.
Resource of type "native"
is expected to be a JAR file with a set of native libraries. In most of cases, it makes sense to set the operating system and architecture for this resource too.
Resources of type "jnlp"
are expected to contain JNLP files defining external JNLP extensions.
Filesets of type "license"
can contain arbitrary files, but additional restrictions can be applied when they are actually used (for example, on Mac it has to be a plain text file, and on Windows it needs to be RTF).
Filesets of type "data"
can contain arbitrary files.
Table 10-10 fx:fileset
Attribute Description Type Required?arch
(used only when <fx:fileset>
is nested under <fx:resources>
Specifies the architecture for which these resources should be considered.
String
No
Default is any
.
excludes
--
String
--
includes
--
String
--
os
(used only when <fx:fileset>
is nested under <fx:resources>
Specifies the operating systems for which these resources should be considered.
String
No
Default is any
.
requiredFor
(used only when <fx:fileset>
is nested under <fx:resources>
Defines when resources are needed (affects loading priority). Supported values are:
preloader
- resources are needed to launch the preloader (first thing to be executed)
startup
- resources are needed to launch the application.
runtime
- resources are not critical to launch the application but may be needed later.
String
No
Default is startup
.
type
(used only when <fx:fileset>
is nested under <fx:resources>
Type of the resources in the set. Supported values are:
auto
for autodetect
data
jar
jnlp
license
native
for JAR files containing native libraries
icon
String
No
Default is to guess based on extension.
* If refid
is used, then none of the other parameters can be specified.
None (except standard Ant elements).
<fx:htmlParam> DescriptionParameter to be passed to the embedded or Web Start application from the HTML page. The value of the parameter can be calculated at runtime using JavaScript.
ParametersTable 10-11 fx:htmlParam
Attribute Description Type Required?escape
Defines how to interpret the value for the values that are passedas string literal (true) or JavaScript variable (false).
Boolean
No
Default is true, meaning value is treated as string literal.
name
Name of the parameter to be passed to the embedded or Web Start application from the HTML page.
String
Yes
value
Value of the parameter. Could also be the name of a JavaScript variable whose value is expected to be passed as parameter.
For JavaScript variables, ensure escape
is set to false.
String
Yes
None
<fx:htmlParam> Task Usage Examples<fx:application name="Sample app" mainClass="test.MyApplication"> <!-- Parameters passed from HTML page. Only applicable for embeddeded and Web Start applications and unused when run in a standalone and self-contained context. --> <!-- Parameter with name 'fixedParam', whose value is string '(new Date()).getTime()' --> <htmlParam name="fixedParam" value="(new Date()).getTime()"/> <!-- Parameter with name 'dynamicParam', whose value will be the timestamp of the moment when the application is added to the web page (value will be assigned the result of execution of JavaScript code) --> <htmlParam name="dynamicParam" escape="false" value="(new Date()).getTime()"/> </fx:application>
Passes an icon to the <fx:deploy>
task, other than a splash screen image.
The icon specified in this element is used for Web Start and desktop applications.
Note that in JavaFX 2.2, only icons of type default
are used for self-contained applications. For details on how to customize the icon for self-contained applications, see Section 7.3.3, "Customizing the Package Using Drop-In Resources."
Table 10-12 fx:icon
Attribute Description Type Required?depth
Color depth of the image in bits-per-pixel. Common values are 8, 16, and 24.
String
No
href
Location of image.
For self-contained applications, the supported graphic formats depend on the operating system:
OS X: .icns
Linux: .png
Windows: .ico
Note that if you specify your own icon for a self-contained application, the values of the attributes height
, width
, and depth
are not used. Ensure that the size and the color depth of your custom icons correspond to what your operating system expects.
For Web Start applications, the supported graphic formats are .gif
, .jpg
, .png
, and .ico
.
String
Yes
height
Image height in pixels
String
No
kind
Icon type. Supported values are:
default
disabled
rollover
selected
shortcut
For Web Start applications, this attribute corresponds to the kind
attribute in the icon
element of a JNLP file.
For desktop applications, if this attribute is not specified or set as default
, then the icon specified is the icon of the launcher (.exe
file for Windows, .app
file for OS X), the icon in the taskbar or dock, and in some instances the icon for the installer package (such as a DMG package).
String
No
Default value is default
.
width
Image width in pixels
String
No
None.
<fx:icon> Usage Examples<fx:info title="Sample application"> <!-- icon to be used by default for anything but splash --> <fx:icon href="shortcut.ico" kind="shortcut" width="32" height="32" depth="8"/> </fx:info>
Application description for users. These details are shown in the system dialog boxes, if they need to be shown.
ParametersTable 10-13 fx:info
Attribute Description Type Required?category
Application category. Creates a link to an application in a specified category. Semantics of the value depends on the format of the package.
For example:
For a self-contained application on Linux, it is used to define the application menu category where the application is listed.
On Mac: Creates key in info.plist
<key>LSApplicationCategoryType</key>
<string>unknown</string>
On Windows creates a group, for instance, if you specify "My Music" it will create your app in C:\ProgramData\Microsoft\Windows\Start Menu\Programs\My Music
String
No
copyright
Short copyright statement
String
No
description
A short statement describing the application.
String
No
license
License type (for example, GPL). As of JavaFX 2.2, this attribute is used only for Linux bundles.
String
No
title
Title of the application
String
Yes
vendor
Provider of the application
String
Yes
<fx:info vendor="Uncle Joe" description="Test program"/>
The JVM argument to be set in the JVM, where the application is executed. Can be used multiple times. Note that you do not need to additionally escape values if they contain space characters.
ParametersTable 10-14 fx:jvmarg
Attribute Description Type Required?value
Value of JVM argument.
String
Yes
None.
<fx:jvmuserarg> DescriptionThe user overridable JVM argument to be set in the JVM, where the application is executed. Can be used multiple times. Note that you do not need to additionally escape values if they contain space characters.
ParametersTable 10-15 fx:jvmuserarg
Attribute Description Type Required?value
Value of JVM argument.
String
Yes
None.
<fx:param> DescriptionParameter to be passed to the application (embedded into application package).
This tag has no impact on standalone applications, including self-contained applications.
ParametersTable 10-16 fx:param
Attribute Description Type Required?name
Name of parameter
String
Yes
value
Value of parameter
String
Yes
None.
<fx:param> Task Usage Examples<fx:application name="Sample app" mainClass="test.MyApplication"> <!-- parameter with name 'simpleParam' and fixed string value--> <param name="simpleParam" value="something"/> <!-- parameter with name 'complexParam' with value generated at build time --> <param name="complexParam" value="Compiled by ${java.version}"/> <!-- parameter with name 'novalueParam' and no value --> <param name="novalueParam"/> </fx:application>
Definition of security permissions needed by application. By default, the application runs in the sandbox. Requesting elevated permissions requires signing the application JAR files.
This option has no impact on standalone applications, including self-contained applications.
ParametersTable 10-17 fx:permissions
Attribute Description Type Required?cachecertificates
If set to true, then the certificate used to sign the JAR files are cached in the deployment descriptor. Caching enables the user to accept elevated permissions earlier in the startup process, which improves startup time.
This setting has no effect if the application is run in the sandbox.
Boolean
No
Default is false.
elevated
If set to false, the application runs in the sandbox.
Boolean
No
Default is false.
None.
<fx:platform> DescriptionDefines application platform requirements.
ParametersTable 10-18 fx:platform
Attribute Description Type Required?refid
*
--
Reference
No
javafx
Minimum version of JavaFX required by the application.
String
No
Default value matches the release of the JavaFX SDK; for example, if you use the JavaFX 2.2 SDK, the default value is '2.2'.
j2se
Minimum version of JRE required by the application.
String
No
Default is any JRE supporting JavaFX.
* If refid
is used, then none of the other parameters can be specified.
In this example, the application needs JavaFX Runtime version 2.1 or later and JRE version 7.0 or later.
<fx:platform javafx="2.1+" j2se="7.0"/>
In this example, the application needs JavaFX Runtime version 2.1 or later and needs to run in a JVM launched with "-Xmx400 -verbose:jni -Dpurpose="sample value"
.
<fx:platform javafx="2.1+"> <fx:jvmarg value="-Xmx400m"/> <fx:jvmarg value="-verbose:jni"/> <property name="purpose" value="sample value"/> </fx:platform>
In this example, -Xmx768m is passed as a default value for heap size. The user can override this value in a user configuration file.
<fx:platform> <fx:jvmuserarg name="-Xmx" value="768m" /> </fx:platform>
Deployment preferences for the application. Preferences can be expressed but may not necessarily be satisfied, for example in the following cases:
The packager may ignore a preference if it is not supported for a particular execution mode.
JRE may ignore it if it is not supported.
The user may reject a request, for example if he is prompted whether a desktop shortcut can be created.
Table 10-19 fx:preferences
Attribute Description Type Required?install
Install true
means that the application is installed for the system and false
means the application is installed for the current user only.
For self-contained applications, true
indicates a developer preference that the application package should perform a system-wide installation. If false,
then a package is generated for per-user installation.
This value is ignored if the packager does not support different types of install packages for the requested package format.
Boolean
No
For Web Start and embedded applications, default is false
.
For self-contained applications, default value is different for various package formats.
menu
If true,
then the application requests to add an entry to the system application menu.
Boolean
No
Default is false
.
refid
*
--
Reference
No
shortcut
If true then application requests a desktop shortcut to be created.
Boolean
No
Default is false
.
* If refid
is used, then none of the other parameters can be specified.
None.
<fx:preferences> Usage ExamplesThis example shows a request to create a desktop shortcut.
<fx:preferences id="p1" shortcut="true"/>
This example does the following:
It requests creation of a web deployment descriptor that will add the application to the Applications Menu and mark it as installed (in other words, the application will be listed in Add/Remove programs.)
If self-contained bundles are created, then they will be installed system-wide and will create an application entry in the Applications menu.
<fx:preferences shortcut="false" install="true" menu="true"/>
This example uses a reference to the <fx:preferences> parameter in <fx:preferences> Parameter to Add a Desktop Shortcut to create the shortcut.
<fx:resource refid="p1"/>
Optional element and can be used multiple times. Java property to be set in the JVM where the application is executed.
ParametersTable 10-20 fx:property
Attribute Description Type Required?name
Name of property to be set.
String
Yes
value
Value of property to be set.
String
Yes
None.
<fx:resources> DescriptionThe collection of resources used by the application. Defined as a set of JavaFX FileSet filters. Could be reused using id
or refid
.
Table 10-21 fx:resources
Attribute Description Type Required?id
ID that can be referred from another element with a refid attribute.
String
No
refid
*
--
Reference
No
* If refid
is used, then none of the other parameters can be specified.
See also examples in Chapter 5, "Packaging Basics" and Chapter 7, "Self-Contained Application Packaging."
In this example, both <fx:resources>
elements define the collection, consisting of s.jar in the dist directory. The first <fx:resources>
element uses an id
attribute, and the second <fx:resources>
element refers to the first with the refid
attribute.
<fx:resources id="aaa"> <fx:fileset dir="dist" includes="s.jar"/> </fx:resources> <fx:resources refid="aaa"/>
If you mix signed and unsigned JAR files, use an additional <fx:deploy> Ant task to generate an extension descriptor for each JAR file, and refer to the extension descriptors by treating them as resources in the main file, as shown in this example.
<!-- Prepare extension --> <fx:deploy extension="true" outdir="dist" outfile="other"> ... <fx:deploy> <!-- Use it in the main descriptor --> <fx:deploy outdir="web-dist" ...> ... <fx:resources> <fx:fileset dir="dist" includes="other.jnlp"/> ... </fx:resources> <fx:deploy>
Identifies a secondary entry point for a self-contained application. This parameter is ignored for standalone applications, applications embedded in a web page, or applications launched from a browser.
This parameter is valid only for Windows and Linux applications.
ParametersTable 10-22 <fx:secondaryLauncher>
Attribute Description Type RequiredappDescription
Brief description of the application.
String
No
icon
Path to the icon file for the application.
String
No
mainClass
Qualified name of the main application class.
String
No
menu
Flag that indicates if the application is added to the Start menu. The default is true
.
Either the menu
attribute or shortcut
attribute must be set to true
. If both attributes are set to false
, then the application is added to the Start menu.
Boolean
No
name
Name of the launcher that is used to start the application.
String
Yes
shortcut
Flag that indicates if a shortcut to the application is added to the desktop. The default is false
.
Either the menu
attribute or shortcut
attribute must be set to true
. If both attributes are set to false
, then the application is added to the Start menu.
Boolean
No
title
Title of the application.
String
No
vendor
Name of the vendor that provided the application.
String
No
version
Version of the application.
String
No
Passes the location of the image to be used as a splash screen. Currently custom splash images can only be passed to Web Start applications, and use of this parameter has no impact on standalone applications or applications embedded into web pages.
ParametersTable 10-23 fx:splash
Attribute Description Type Required?href
Location of image. Supported graphic formats are JPEG, GIF, and PNG.
String
Yes
mode
Deployment mode. Supported values are:
any
(but currently only functional in Web Start mode)
webstart
String
No
Default value is any
.
None.
<fx:splash> Usage ExamplesIn the following example, splash images of various types are passed.
<fx:info title="Sample application"> <fx:splash href="http://my.site/custom.gif"/> </fx:info>
Template to preprocess. A template is an HTML file that contains markers to be replaced with the JavaScript or HTML snippets that are required for web deployment. Using templates enables you to deploy your application directly into your own web pages. This simplifies the development process, especially when the application is tightly integrated with the page, for example when the web page uses JavaScript to communicate to the application.
Template markers have one of the following forms:
#
XXX#
#
XXX(
id)#
id is the identifier of an application and XXX is one of following:
DT.SCRIPT.URL
Location of dtjava.js
in the Deployment Toolkit. By default, the location is
https://java.com/js/dtjava.js
.
DT.SCRIPT.CODE
Script element to include dtjava.js
of the Deployment Toolkit.
DT.EMBED.CODE.DYNAMIC
Code to embed the application into a given placeholder. It is expected that the code will be wrapped in the function()
method.
DT.EMBED.CODE.ONLOAD
All the code needed to embed the application into a web page using the onload
hook (except inclusion of dtjava.js
).
DT.LAUNCH.CODE
Code needed to launch the application. It is expected that the code will be wrapped in the function()
method.
A page with different applications can be processed multiple times, one per application. To avoid confusion, markers must use application IDs with an alphanumeric string and no spaces.
If the input and output files are the same then the template is processed in place.
ParametersTable 10-24 fx:template
Attribute Description Type Required?file
Input template file.
File
Yes
tofile
Output file (after preprocessing).
File
No
Default is the same as the input file.
None
<fx:template> Usage ExamplesThis example shows a <fx:template>
parameter in which both input and output files are specified.
<fx:template file="App_template.html" tofile="App.html"/>
<fx:deploy placeholderId="ZZZ" width="600" height="400" outdir="dist-web" outfile="App1"> <fx:application id="myApp" name="Demo" mainClass="fish.FishApplication"/> <fx:template file="src/templates/EmbedApp_template.html" tofile="dist-web/EmbedApp.html"/> <fx:resources> <fx:fileset requiredFor="startup" dir="dist" includes="*.jar"/> </fx:resources> </fx:deploy>
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4