Java Reference
In-Depth Information
F Index your classes —one way to improve startup performance is through the use of
JAR class indexing. Traditionally, the class loader will traverse each JAR to look for
a classes to load. This can be a performance killer at startup to wait for JARs to
download and classes to be loaded. Indexing is used to by the class loader to find
classes quickly that are embedded in the JARs. To index your classes, use the jar
command line tool with the -i option followed by a list of JAR files to be indexed
(as shown next). The index information is saved as a text file embedded inside the
first JAR file listed in the command.
jar -i main-app.jar \
jar-module-1.jar \
jar-module-2.jar \
jar-module-3.jar \
...
jar-module-N.jar
F Compress JARs with Pack200 —it goes without saying that the size of your JAR files
will impact startup time. You can further squeeze the size of your JAR files with the
pack200 option when packaging your application with the javafxpacakger , using
the -pack200 flag as follows:
javafxpackager -src src \
-appClass draggable.demo.Main \
-appName demo-app \
-pack200
In addition to demo-app.jar , this command line also
generates the file demo-app.jar.pack.gz that will be
downloaded at runtime. The command also injects the
property jnlp.packEnabled into the JNLP file as follows:
<jnlp>
...
<resources>
...
<property name=" jnlp.packEnabled " value=" true "/>
</resources>
</jnlp>
F Provide ample memory —avoid application death caused by 'out of memory' exceptions.
This is a nasty situation which can damage the reputation of your app as being broken.
The good news is, it can be easily prevented by setting the heap size of your app in the
JNLP file
<jnlp> ...
<resources>
<j2se version="1.6+" max-heap-size ="256m" />
...
</resources>
</jnlp>
 
Search WWH ::




Custom Search