JavaFX application packaging & deployment with dependent libraries

Sergey Troshin stroshin at yandex.ru
Wed Apr 3 03:02:23 PDT 2013


Hi all,

I have one question on the packaging of a JavaFX application dependent 
on additional user libraries.

My project consists of the command-line tool designed as the standalone 
JAR package (tool.jar), and of the UI tool created as the JavaFX 
application (tool-ui.jar). The UI tool uses the command-line tool JAR as 
the library, and on its own implements the FX application classes and 
related UI elements. The project wizard of NetBeans 7.3 created for me 
the FX project with a number of XMLs. When I instruct NetBeans to use 
tool.jar as the required library for the FX application, it copies the 
JAR to dist/lib/tool.jar during the build and hard-codes the property 
"JavaFX-Class-Path: lib/tool.jar" to  the FX MANIFEST of ui-tool.jar. 
That's the problem for me, since I want to make the both tools to be 
available to the users in the same binary directory, like this

bin/
   tool.jar
   ui-tool.jar

It should be possible for my users to use either standalone tool.jar, or 
to use them both over ui-tool.jar launching. However, ui-tool.jar is 
hard-coded to depend on lib/tool.jar, that cannot be changed anyway over 
NetBeans. Surely, I can patch/hack the project XMLs files with build 
rules and targets generated by NB. However, they are pretty messy and 
complex, can be regenerated by NB anytime. Moreover, seems they do use a 
service code from the JDK.

Placing my JARs as described above leads to ClassNotFoundException when 
trying to start `java -jar ui-tool.jar', because lib/tools.jar doesn't 
exist. The workaround is to start the UI tool like this `java -classpath 
tool.jar:ui-tool.jar com/javafx/main/Main'. That works, but I would 
prefer to control the generated JavaFX-Class-Path property, or to change 
the path for dependent libraries in NB. I've seen in NB project the 
settings "Libraries/Library Folder". It doesn't work for me in the 
wanted way - just points to the directory where to get the library, but 
embeds the same property value to the MANIFEST as before.

Please kindly advise how can I deal with this issue,

Thank you,
Sergey Troshin


More information about the openjfx-dev mailing list