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!

Can't access to external .jar libraries within my javafx FXML application

2643246Apr 5 2014

I'm building a FXML application embedded in a browser. In that app I use external librey org.Jsoup that I have downloaded. I use Netbeans 7.4 and when I run my app from the IDE it works fine (as standalone and in browser) but when I try to run it from the server (Tomcat) i find an error in the first line of code that references Jsoup library. I have found many people with same problem that solved it by modifying jnlp file or manifest.mf.

In my web Principal directory i have the folder /lib that contains Jsoup.jar and the jnlp file seems to referenciate it so I guess the problem is manifest.mf.

(Plataforma is the name of my project)

Well the jnlp file contains this:


<?xml version="1.0" encoding="utf-8"?>

<jnlp spec="1.0" xmlns:jfx="http://javafx.com" href="Plataforma.jnlp">

  <information>

    <title>Plataforma</title>

    <vendor>admin</vendor>

    <description>null</description>

    <offline-allowed/>

  </information>

  <resources>

    <jfx:javafx-runtime version="2.2+" href="http://javadl.sun.com/webapps/download/GetFile/javafx-latest/windows-i586/javafx2.jnlp"/>

  </resources>

  <resources>

    <j2se version="1.6+" href="http://java.sun.com/products/autodl/j2se"/>

    <jar href="Plataforma.jar" size="25190" download="eager" />

    <jar href="lib/jsoup-1.7.3.jar" size="321655" download="eager" />

  </resources>

<security>

  <all-permissions/>

</security>

  <applet-desc  width="800" height="600" main-class="com.javafx.main.NoJavaFXFallback"  name="Plataforma" >

    <param name="requiredFXVersion" value="2.2+"/>

  </applet-desc>

  <jfx:javafx-desc  width="800" height="600" main-class="plataforma.Plataforma"  name="Plataforma" />

  <update check="always"/>

</jnlp

and the MANIFEST.MF inside the jar contains this

Manifest-Version: 1.0

Implementation-Vendor: admin

JavaFX-Version: 2.2

Implementation-Title: Plataforma

Implementation-Version: 1.0

JavaFX-Application-Class: plataforma.Plataforma

JavaFX-Class-Path: lib/jsoup-1.7.3.jar

Permissions: all-permissions

Created-By: JavaFX Packager

Main-Class: com/javafx/main/Main

Codebase: *

Name: com/javafx/main/Main.class

SHA-256-Digest: KxYytwZASwvQ4mPhOoRW7nGAOOjprQpEaG3vjY5b4mQ=

Name: plataforma/Plataforma.class

SHA-256-Digest: ecdJZ87YtRjYkHA3Lb/Oy/iQbytqBvznyFacfqysKiA=

Name: com/javafx/main/Main$2.class

SHA-256-Digest: vZSZLfGvC6SeQGWGSpezFhSgrDrSvZRDLqJTFP6SVdY=

Name: com/javafx/main/NoJavaFXFallback.class

SHA-256-Digest: jvGBkWbtsUnepWPF8LiNlcXwm4Lud9yixXLGZB/Uih8=

Name: plataforma/FXMLControlador.class

SHA-256-Digest: Ui1OFMfxxvell/GA3xfJXQVPKES8evw3t5aXTXctQe4=

Name: com/javafx/main/Main$1.class

SHA-256-Digest: Va4S3oQbyRywYzYUOxCBCMWtMWBV9dQKLRxHcYpdroc=

Name: plataforma/FXMLDocument.fxml

SHA-256-Digest: ovElG4iLU1ei35byEGaWZqy5S0liFr9f3lqUgdg6pRs=

this MANIFEST.MF is uneditable but i tryed to add this code that i found on the net to manifest.mf and nothing happened when i re-build the project. MANIFEST.MF didn't slightly changed.

Manifest-Version: 1.0

X-COMMENT: Main-Class will be added automatically by build

<fxjar destfile="${jfx.deployment.dir}/${jfx.deployment.jar}" applicationClass="${main.class}" >

      <fileset dir="${build.classes.dir}"/>

      <manifest>

        <attribute name="Implementation-Vendor" value="${application.vendor}"/>

        <attribute name="Implementation-Title" value="${application.title}"/>

        <attribute name="Implementation-Version" value="1.0"/>

      </manifest>

      <!-- Setup the classpath for the generated .jar here -->

      <fx:resources>

        <fx:fileset type="jar" dir="lib" includes="jsoup-1.7.3.jar"/>

      </fx:resources>

</fxjar>

<property name="jfx.deployment.web.dir" location="${jfx.deployment.dir}/web" />

<mkdir dir="${jfx.deployment.web.dir}" />

<fxdeploy width="${jfx.applet.width}" height="${jfx.applet.height}"

              outdir="${jfx.deployment.web.dir}" <!-- NEW DIR -->

              embedJNLP="true"

              outfile="${application.title}">

        <info title="${application.title}"

              vendor="${application.vendor}"/>

        <application name="${application.title}"

                     appclass="${main.class}"/>

        <fx:resources type="eager">

           <fileset dir="${jfx.deployment.web.dir}"> <!-- NEW DIR -->

              <include name="${jfx.deployment.jar}"/>

              <include name="lib/*.jar"/>

              <exclude name="**/jfxrt.jar"/>

           </fileset>

        </fx:resources>

</fxdeploy>

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 3 2014
Added on Apr 5 2014
0 comments
920 views