javafx8应用程序可执行文件

时间:2016-04-24 05:53:28

标签: java eclipse javafx javafx-8

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

i get this when i run the app

这是我的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>

请帮帮我。

2 个答案:

答案 0 :(得分:0)

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

答案 1 :(得分:0)

对话框显示您的主类中发生异常。您是否正在捕获主类可能引发的所有可能的异常?如果在IDE中未生成任何异常,则可能要检查所有外部库和资源都在类路径上。