Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

HOW to include the needed libraries to be copied into the self-cotained app

930592Sep 4 2012 — edited Sep 5 2012
I'm using: Netbeans 7.2, JavaFX 2.2, JDK 7u7. First, I believe the instructions posted at http://docs.oracle.com/javafx/2/deployment/self-contained-packaging.htm#A1349508 are off (when dealing with NetBeans, at least), as the resulting bundle copies the dependent libraries (3rd party) to the root where the main .jar file is placed, but the MANIFEST gets JavaFX-Class-Path with the lib/ prefix.

This is what I have added to build.xml in the project's folder:
   <target name="-post-jfx-deploy">
        <fx:deploy verbose="true" nativeBundles="image" outdir="${basedir}/${dist.dir}" outfile="${application.title}">
            <fx:application name="${application.title}" mainClass="${javafx.main.class}"/>
            <fx:resources>
                <fx:fileset dir="${basedir}/${dist.dir}" includes="*.jar"/>
                <fx:fileset dir="${basedir}/${dist.dir}/lib" includes="*.jar"/>
            </fx:resources>
            <fx:info title="${application.title}" vendor="${application.vendor}"/>
        </fx:deploy>
    </target>
This is the tree structure of the dist folder after Clean and Build Project has been triggered by NetBeans:
│   JFXA.html
│   JFXA.jar
│   JFXA.jnlp
│
├───lib
│       log4j-1.2.16.jar
│
└───web-files
        dtjava.js
        error.png
        get_java.png
        get_javafx.png
        javafx-chrome.png
        javafx-loading-100x100.gif
        javafx-loading-25x25.gif
        upgrade_java.png
        upgrade_javafx.png
And this is the structure of the created bundle (conents of the JRE runtime omitted):
└───JFXA
    │   JFXA.exe
    │   JFXA.ico
    │
    ├───app
    │       JFXA.jar
    │       log4j-1.2.16.jar
    │       package.cfg
    │
    └───runtime
        └───jre
Problem is, when I run the application (the *.exe* inside the bundle) it tries to run the main *.jar*, but fails due to the inability to locate compile-time libraries. Apparently, this behavior is due to the MANIFEST of the *.jar* being linked to the folder named lib (defaults), but the build script copies the libraries to the output dir where the actual *.jar* resides (dist). How can I fix this? Thanks.

I think I have ran into the same problem as here: 2428813

Edit*:

Upon .jar extraction and further inspection of the MANIFEST file, I see this:

JavaFX-Class-Path: lib/log4j-1.2.16.jar

Currently, as mentioned above, the libraries end up in the root folder where the main .jar resides, due to:

*<fx:fileset dir="${basedir}/${dist.dir}/lib" includes="*.jar"/>*

So, my question is, what do I need to change in order to get the dependent libraries to be copied into the correct path (with lib prefix), when building a bundle? The *<fx:fileset>* does not seem to support anu attribute that would specify the output path structure..
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 3 2012
Added on Sep 4 2012
4 comments
472 views