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

标签 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中作为一个 Ant 任务运行。他们都在我的项目中使用.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,但似乎找不到任何相关内容。我可能只是使用了错误的搜索词。

任何帮助将不胜感激。

谢谢,
哈代

最佳答案

如果您使用的是netbeans,则在项目上单击鼠标右键,然后依次转到“项目属性”和“库”,然后单击“管理平台”,然后选择“默认Javafx平台”,然后转到“JAVAFX”选项卡,然后将JAVAFX SDK的位置更改为Java fx 2 sdk所在的位置。并同样更改JAVAFX JRE。希望这能解决您的问题。

关于deployment - 部署JavaFX应用程序时出现运行时错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12425843/

相关文章:

python - Streamlit azure 部署请稍候屏幕错误

azure - VSO 未使用 WebJob 部署 Azure 网站

java - 无法在 WinXP 32 位上为 JavaFX 应用程序构建 native 包

java - 简单的 JavaFX HelloWorld 不起作用

python - erlang 使用 erlport 生成 python 实例时出现 erlang 错误

c++ - (C++) 按位或运算时出现错误 "Illegal instruction (core dumped)"

c# - WPF C# 应用程序部署 - 运行 exe 时没有任何反应

grails - 如何在已部署的 Grails 2.1.0 应用程序中包含 Groovy 2.0?

javafx-2 - 如何让圆圈在事件中移动?

java - ArrayList 的 IndexOutOfBoundException