8

I have created a JavaFX application, and created its native bundle using Ant. When I am trying to launch application using Jar from bundle created with double click, it successfully launching my application. But when I am trying double click on MyApplication.exe (say), it throwing JavaFX Launcher Error "Exception while running Application".

I have compared both jre, there are many missing jar, exe, dll and some properties files I found.

I have these environment settings -

JAVA_HOME -- C:\Program Files\Java\jdk1.7.0_10
JREFX_HOME -- C:\Program Files\Oracle\JavaFX 2.2 Runtime
Path contains an entry of C:\Program Files\Java\jdk1.7.0_10\bin

JAVA_HOME and JREFX_HOME are used as in my build.xml to take ant-javafx.jar and jfxrt.jar --

${env.JAVA_HOME}/lib/ant-javafx.jar
${env.JREFX_HOME}/lib/jfxrt.jar

My steps to create bundle are -

<target name="CreatingExe" depends="SignedJar">
            <fx:deploy width="800" height="600" nativeBundles="all" outdir="${OutputPath}" outfile="${app.name}">
                <fx:info title="${app.title}"/>
                    <fx:application name="${app.title}" mainClass="${main.class}"/>
                    <fx:resources>
                        <fx:fileset dir="${OutputPath}" includes="*.jar"/>
                <fx:fileset dir="${WorkingFolder}/temp"/>
            </fx:resources>
         </fx:deploy>
 </target>

What more needed in build.xml so that application launch correctly with exe ?

Thanks

Neelam Sharma
  • 2,745
  • 4
  • 32
  • 73
  • 1
    jdk7u10 includes the all javafx runtime and development tools, so you shouldn't source or use javafx bits outside of the jdk directory - i.e. don't use anything from `C:\Program Files\Oracle\JavaFX 2.2 Runtime` ever. – jewelsea Jan 10 '13 at 08:15
  • @jewelsea we have updated our path to take jfxrt.jar as - ${env.JAVA_HOME}/jre/lib/jfxrt.jar, nothing changed!! How can I copy complete jre folder while creating bundle to "bundles\MyApplication\runtime\jre" folder. – Neelam Sharma Jan 10 '13 at 09:59
  • It is saying that "Only a subset of Java Runtime is included by default. Some optional and rarely used files are excluded to reduce the package size, such as all executables. If you need something that is not included by default, then you need to copy it in as a post-processing step. For installable packages, you can do this from the config script that is executed after populating the self-contained application folder." But how to do this? I don't have an idea. – Neelam Sharma Jan 10 '13 at 12:04
  • As @jewelsea mentioned, you should use ${env.JAVA_HOME}/lib/ant-javafx.jar & ${env.JAVA_HOME}/lib/jfxrt.jar AND NOT JREFX_HOME !!! You have JavaFX inside jdk1.7.0_10 so uninstall everything else including "C:\Program Files\Oracle\JavaFX 2.2 Runtime" you only need jdk1.7.0_10 – drzymala Jan 14 '13 at 01:59
  • 5
    I have this same problem and I don't know how to fix. Deployment of JavaFX applications is frustrating me. – ceklock Jan 14 '13 at 17:06

1 Answers1

2

The problem of not launching JavaFx exe resolved by copying jre from "C:\Program Files\Java\jdk_version\jre" to \bundles\MyApplication\runtime\jre in build steps upon creating exe as -

<target name="CopyJre" depends="CreatingExe"> 
 <delete dir="${app_path}/bundles/MyApplication/runtime/jre"/>
 <mkdir dir="${app_path}/bundles/MyApplication/runtime/jre"/>
 <copy todir=${app_path}/bundles/MyApplication/runtime/jre">
   <fileset dir="${env.JAVA_HOME}/jre" />
 </copy>
</target>

JAVA_HOME = C:\Program Files\Java\jdk_version

Thanks

Neelam Sharma
  • 2,745
  • 4
  • 32
  • 73