部署JavaFX应用程序时出现运行时错误

时间:2012-09-14 13:43:32

标签: deployment javafx-2 runtime-error

我正在尝试部署JavaFX应用。我一直在努力的应用程序相当复杂,包括几个库。当我创建一个jnlp并尝试运行它时,我总是收到“运行时错误。点击查看详细信息”消息。有人建议我尝试只做一个简单的Hello World应用程序来查看它是否与包含的库有关。我试过了,我仍然得到“运行时错误。”

这是我正在尝试使用的build.xml。

    <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>

对于Hello World版本,我刚刚删除了<fx:resources>部分。 我从eclipse中运行它们作为蚂蚁任务。他们都在我的项目中使用.jnlp和.html文件创建了一个dist文件夹。然后我点击jnlp运行应用程序并看到一个小窗口,其中包含文本“运行时错误。点击查看详细信息。”我点击它并得到一个错误窗口,上面写着“应用程序无法运行。执行应用程序时出错。单击“详细信息”以获取更多信息。“我单击”详细信息“按钮,查看包含以下信息的Java控制台(HelloWorld版本):

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

当我运行我正在处理的应用程序时,我得到了几乎相同的错误。 我刚刚卸载了java,然后重新安装了最新的SDK。除了可能使用64位JVM而不是我安装的32位JVM之外,这没有做任何事情。错误消息保持不变。

有谁知道我做错了什么?我的构建脚本不正确吗?有更好的部署方式吗?我没有jnlp所以我对任何部署方法都开放。我只需要一些我可以在Windows机器上运行的东西,可能还需要一台mac。

我试过谷歌搜索我的问题,我搜索了StackOverflow,似乎找不到任何相关的东西。我可能只是使用了错误的搜索词。

非常感谢任何帮助。

谢谢, 哈迪

2 个答案:

答案 0 :(得分:2)

如果您正在使用netbeans,请右键单击Project并转到Project Properties,然后单击Libraries,然后单击Manage Platform,然后选择Default Javafx platform,然后转到JAVAFX选项卡,然后将JAVAFX SDK位置更改为Java fx所在的位置2 sdk也同样改变了JAVAFX JRE。希望这能解决你的问题。

答案 1 :(得分:1)

我最终发现,在我的情况下,这个问题是由jar签名过程中的错误引起的。通过清空Java缓存可以避免这个问题(在Windows上,这可以通过Java控制面板完成)。执行此操作并重建后,错误不再发生在我的情况下。

我不确定这会解决您的问题,因为您似乎没有进行任何签名。

相关问题