This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 262507 - javafx unable to run jar outside dist folder
Summary: javafx unable to run jar outside dist folder
Status: RESOLVED FIXED
Alias: None
Product: javafx
Classification: Unclassified
Component: Deployment (show other bugs)
Version: 8.1
Hardware: PC Windows 7
: P1 normal (vote)
Assignee: Roman Svitanic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-06-21 09:51 UTC by pbuser
Modified: 2017-05-10 12:31 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description pbuser 2016-06-21 09:51:34 UTC
I'm unable to run jar outside the dist folder.

Here is the build.xml I have used. I'm not sure how to add the libraries in the MyProject jar using the build.xml.

<?xml version="1.0" encoding="UTF-8"?>
<project name="MyProject" default="default" basedir="." xmlns:fx="javafx:com.sun.javafx.tools.ant">
    <description>Builds, tests, and runs the project MyProject.</description>
    <import file="nbproject/build-impl.xml"/>
     <target name="-post-jfx-deploy">
           <fx:deploy width="${javafx.run.width}" height="${javafx.run.height}" 
                     nativeBundles="all"
                     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="MyProject.jar"/>
              </fx:resources>
              <fx:info title="MyProject" vendor="MyProject"/>
         </fx:deploy>          
       </target>
</project>
Comment 1 pbuser 2016-07-27 08:44:54 UTC
Please let me know if I missed any information.
Comment 2 Tomas Zezula 2017-05-10 12:31:09 UTC
The
<fx:fileset dir="${basedir}/${dist.dir}" includes="MyProject.jar"/>
is missing the dependencies copied into the ${dist.dir}/lib.
You need to add them as well:
<fx:fileset dir="${basedir}/${dist.dir}/lib" includes="*.jar"/>

But better is to use the IDE built in JFX packaging which can be configured in the JFX Project Properties/Build/Deployment.
You need to enable "Enable Native Packaging"
And after it the JFX Project will have action "Package As" in the pop up menu.