Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Runtime error when deploying a JavaFX application

I'm trying to deploy a JavaFX app. The app I've been working on is fairly complex and includes several libraries. When I create a jnlp and try to run it I always get a "Runtime error. Click for details" message. Someone suggested I try doing just a simple Hello World app to see if it's an issue with the included libraries. I tried that and I still get the "Runtime error."

Here's the build.xml I'm trying to use.

    <project name="App" default="default" basedir="." xmlns:fx="javafx:com.sun.javafx.tools.ant">
        <taskdef resource="com/sun/javafx/tools/ant/antlib.xml"
             uri="javafx:com.sun.javafx.tools.ant"
             classpath="C:\Program Files\Java\jdk7\lib\ant-javafx.jar" />


        <target name="default">
        <fx:deploy width="600" height="400" outdir="${basedir}/dist" outfile="App">
            <fx:application name="App" mainClass="${javafx.main.class}"/>

            <fx:resources>
                <!-- include application jars -->
                <fx:fileset dir="${basedir}" includes="*.jar"/>
                <fx:fileset dir="${basedir}/lib" includes="*.jar"/> 
                <fx:fileset dir="${basedir}" includes="app.ini" />
                <fx:fileset dir="${basedir}/template" includes="*.template" />
            </fx:resources>

            <!-- request user level installation -->
            <fx:preferences install="false"/>
        </fx:deploy>
        </target>
    </project>

For the Hello World version I just removed the <fx:resources> section. I run both of them from inside eclipse as an ant task. They both created a dist folder in my project with a .jnlp and a .html file. I then click on the jnlp to run the app and see a small window that has the text, "Runtime error. Click for details.' I click it and get an error window that says, "The application failed to run. There was an error while executing the application. Click 'Details' for more information." I click the 'Details' button and see a Java Console with the following information (HelloWorld version):

Java Plug-in 10.7.2.11
Using JRE version 1.7.0_07-b11 Java HotSpot(TM) 64-Bit Server VM
User home directory = C:\Users\user
----------------------------------------------------
c:   clear console window
f:   finalize objects on finalization queue
g:   garbage collect
h:   display this help message
l:   dump classloader list
m:   print memory usage
o:   trigger logging
q:   hide console
r:   reload policy configuration
s:   dump system and deployment properties
t:   dump thread list
v:   dump thread stack
x:   clear classloader cache
0-5: set trace level to <n>
----------------------------------------------------
Match: beginTraversal
Match: digest selected JREDesc: JREDesc[version 1.6+, heap=-1--1, args=null,         href=http://java.sun.com/products/autodl/j2se, sel=false, null, null], JREInfo: JREInfo for index 0:
platform is: 1.7
product is: 1.7.0_07
location is: http://java.sun.com/products/autodl/j2se
path is: C:\Program Files\Java\jre7\bin\javaw.exe
args is: null
native platform is: Windows, amd64 [ x86_64, 64bit ]
JavaFX runtime is: JavaFX 2.2.1 found at C:\Program Files\Java\jre7\
enabled is: true
registered is: true
system is: true

Match: ignoring maxHeap: -1
Match: ignoring InitHeap: -1
Match: digesting vmargs: null
Match: digested vmargs: [JVMParameters: isSecure: true, args: ]
Match: JVM args after accumulation: [JVMParameters: isSecure: true, args: ]
Match: digest LaunchDesc: file:/G:/workspaces/JavaProjects/JavaFXHelloWorld/dist/HelloWorld.jnlp
Match: digest properties: []
Match: JVM args: [JVMParameters: isSecure: true, args: ]
Match: endTraversal ..
Match: JVM args final: 
Match: Running JREInfo Version    match: 1.7.0.07 == 1.7.0.07
Match: Running JVM args match: have:<>  satisfy want:<>
CacheEntry[file:/G:/workspaces/JavaProjects/JavaFXHelloWorld/dist/HelloWorld.jnlp]:    updateAvailable=false,lastModified=Fri Sep 14 07:13:28 MDT 2012,length=915

I get a nearly identical error when I run the app I'm working on. I just uninstalled java and then reinstalled the latest SDK. That didn't do anything except may the app use the 64 bit JVM instead of a 32 bit JVM I had installed. The error message stayed the same.

Does anyone know what I'm doing wrong? Is my build script incorrect? Is there a better way to deploy? I don't have to have a jnlp so I'm open to any deploy method. I just need something I can run on a windows machine and possibly a mac.

I've tried googling my problem and I've searched StackOverflow and can't seem to find anything relevent. I might just be using the wrong search terms.

Any help would be greatly appreciated.

Thanks, Hardy

like image 408
Hardy Avatar asked Sep 14 '12 13:09

Hardy


People also ask

How do I deploy JavaFX app?

Deployment Modes JavaFX applications can be run in several ways: Launch as a desktop application from a JAR file or self-contained application launcher. Launch from the command line using the Java launcher. Launch by clicking a link in the browser to download an application.

Which extension is used to deploy entire JavaFX application?

The JavaFX application package that is generated by default includes: An executable application JAR file, which contains application code and resources and can be launched by double-clicking the file. Additional application JAR and resource files. A deployment descriptor for web deployment (kept in the JNLP file)

Can JavaFX run in a browser?

The recommended way to embed a JavaFX application into a web page or launch it from inside a web browser is to use the Deployment Toolkit library. The Deployment Toolkit provides a JavaScript API to simplify web deployment of JavaFX applications and improve the end user experience with getting the application to start.


1 Answers

If you are using netbeans then Right Click on the Project and Go to Project Properties then to Libraries then click on Manage Platform then select the Default Javafx platform then go to JAVAFX tab and then change the JAVAFX SDK location to where your Java fx 2 sdk is and also similarly change the JAVAFX JRE. Hope this will solve your Problem.

like image 193
Bipin Bhandari Avatar answered Oct 02 '22 12:10

Bipin Bhandari