【问题标题】:javafx8 application executablejavafx8 应用程序可执行文件
【发布时间】:2016-08-17 14:47:35
【问题描述】:

我在 Eclipse 中使用javafx8 创建了一个媒体播放器。 jar 文件生成正确,但是当我运行可执行文件时,出现以下消息

这是我的build.xml。我试图做一些修改,但它不起作用。我正在使用jdk.1.8.0

    <taskdef resource="com/sun/javafx/tools/ant/antlib.xml"
        uri="javafx:com.sun.javafx.tools.ant"
        classpathref="fxant"/>
</target>
<target name="setup-staging-area">
    <delete dir="externalLibs" />
    <delete dir="project" />
    <delete dir="projectRefs" />

    <mkdir dir="externalLibs" />

    <copy todir="externalLibs">
        <fileset dir="\Android programming\PiliPlayer">
            <filename name="images"/>
        </fileset>
    </copy>

    <mkdir dir="project" />
    <copy todir="project">
        <fileset dir="D:\Android programming\PiliPlayer">
            <include name="src/**" />
        </fileset>
    </copy>

    <mkdir dir="projectRefs" />
</target>
<target name='do-compile'>
    <delete dir="build" />
    <mkdir dir="build/src" />
    <mkdir dir="build/libs" />
    <mkdir dir="build/classes" />

    <!-- Copy project-libs references -->
    <copy todir="build/libs">
        <fileset dir="externalLibs">
            <include name="images"/>
        </fileset>
    </copy>

    <!-- Copy project references -->

    <!-- Copy project sources itself -->
    <copy todir="build/src">
        <fileset dir="project/src">
            <include name="**/*"/>
        </fileset>
    </copy>

    <javac includeantruntime="false" source="1.8" target="1.8" srcdir="build/src" destdir="build/classes" encoding="Cp1252">
        <classpath>
            <fileset dir="build/libs">
                <include name="*"/>
            </fileset>
        </classpath>
    </javac>

    <!-- Copy over none Java-Files -->
    <copy todir="build/classes">
    <fileset dir="project/src">
        <exclude name="**/*.java"/>
    </fileset>
    </copy>


</target>
<target name="do-deploy" depends="setup-staging-area, do-compile, init-fx-tasks">
    <delete file="dist"/>
    <delete file="deploy" />

    <mkdir dir="dist" />
    <mkdir dir="dist/libs" />

    <copy todir="dist/libs">
        <fileset dir="externalLibs">
            <include name="*" />
        </fileset>
    </copy>


    <fx:resources id="appRes">
        <fx:fileset dir="dist" includes="PiliPlayer.jar"/>
        <fx:fileset dir="dist" includes="libs/*"/>
    </fx:resources>

    <fx:application id="fxApplication"
        name="PILI PLAYER"
        mainClass="application.VedaPlayer"
    />

    <mkdir dir="build/classes/META-INF" />



    <fx:jar destfile="dist/PiliPlayer.jar">
        <fx:application refid="fxApplication"/>
        <fileset dir="build/classes">
        </fileset>
        <fx:resources refid="appRes"/>

        <manifest>
            <attribute name="Implementation-Vendor" value="PlLI AND VEDA"/>
            <attribute name="Implementation-Title" value="PILI PLAYER"/>
            <attribute name="Implementation-Version" value="1.0"/>
            <attribute name="JavaFX-Feature-Proxy" value="None"/>
        </manifest>
    </fx:jar>


    <mkdir dir="deploy" />
    <!-- Need to use ${basedir} because somehow the ant task is calculating the directory differently -->
    <fx:deploy
        embedJNLP="false"
        extension="false"
        includeDT="false"
        offlineAllowed="true"
        outdir="${basedir}/deploy"
        outfile="Pili Player" nativeBundles="msi"
        updatemode="background" >

        <fx:platform basedir="${java.home}"/>
        <fx:info title="Pili Player" vendor="PlLI AND VEDA"/>

        <fx:application refId="fxApplication"/>
        <fx:resources refid="appRes"/>
    </fx:deploy>


</target>

请帮帮我。

【问题讨论】:

    标签: java eclipse javafx javafx-8


    【解决方案1】:

    对话框表明您的主类中发生了异常。您是否捕获了主类可能抛出的所有可能异常?如果 IDE 中没有生成异常,您可能需要检查所有外部库和资源是否都在类路径中。

    【讨论】:

      【解决方案2】:

      信息太少,无法给出准确答案,但您可以尝试在主类中实现日志记录,这样您就可以查看日志文件,抛出什么样的异常以及原因。

      【讨论】:

        猜你喜欢
        • 2014-03-19
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2020-09-15
        • 1970-01-01
        • 2019-03-27
        • 1970-01-01
        相关资源
        最近更新 更多