【问题标题】:fx:deploy application not working but the Java jar is working - Gluon Projectfx:deploy 应用程序不工作,但 Java jar 工作 - Gluon 项目
【发布时间】:2017-08-01 15:18:40
【问题描述】:

我有我的 gluon 项目,它在从 Netbeans IDE 创建的 jar(通过命令行和双击)运行以及使用 ide 运行任务时工作。但我也在尝试部署到一个 msi 和一个 exe,然后再部署到一个 dmg。当我使用 ant 进行部署时,我创建了应用程序并且安装良好。但是当您尝试运行它时,它说找不到类中的主要方法。现在据我所知,您没有将主方法放入胶子应用程序中,当我尝试将基本的主方法放入主类时,我收到了一个空指针异常。我不确定这里的解决方案是什么,我已经通过我用来通过 ant 部署的 build.xml 文件提供。

<project name="No Panics Self Helper"
 xmlns:fx="javafx:com.sun.javafx.tools.ant">
    <path id="fxant">
        <filelist>
            <file name="C:\Program Files\Java\jdk1.8.0_91\lib\ant-javafx.jar"/>
            <file name="C:\Program Files\Java\jdk1.8.0_91\jre\lib\ext\jfxrt.jar"/>
        </filelist>
    </path>

    <taskdef resource="com/sun/javafx/tools/ant/antlib.xml"      
        uri="javafx:com.sun.javafx.tools.ant"
        classpathref="fxant"/>

 <delete dir="dist/bundles/NoPanicsSelfHelper/runtime/jre"/>
 <mkdir dir="dist/bundles/NoPanicsSelfHelper/runtime/jre"/>
 <copy todir="dist/bundles/NoPanicsSelfHelper/runtime/jre">
<fileset dir="C:\Program Files\Java\jdk1.8.0_91\jre" />
 </copy>
<fx:deploy nativeBundles="all" width="600" height="400"
       outdir="${basedir}/dist" outfile="NoPanicsSelfHelper">
<fx:application name="NoPanicsSelfHelper" mainClass="com.nopanicsselfhelper.NoPanicsSelfHelper"/>
<fx:resources>
    <!-- include application jars -->
    <fx:fileset dir="dist" includes="NoPanicsSelfHelper.jar"/>       

    <fileset dir="dist/resources">
    <include name="**"/>
    </fileset>
</fx:resources>
<!-- Custom JVM setup for application -->
<fx:platform>
    <fx:jvmarg value="-Xmx2048m"/>
    <fx:jvmarg value="-verbose:jni"/>
</fx:platform>
<fx:platform basedir="${java.home}"/>      
<fx:platform basedir="C:\Program Files\Java\jdk1.8.0_91"/>
<!-- request user level installation -->
<fx:preferences install="false"/>
</fx:deploy>
</project>

【问题讨论】:

    标签: java ant gluon-mobile


    【解决方案1】:

    答案太简单了。只需添加以下内容。

        public static void main(String[] args) {
        launch(NoPanicsSelfHelper.class);
        }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-11-08
      • 1970-01-01
      • 1970-01-01
      • 2018-07-11
      • 2015-04-11
      相关资源
      最近更新 更多