Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用Ant脚本部署JavaFX应用程序_Ant_Javafx - Fatal编程技术网

使用Ant脚本部署JavaFX应用程序

使用Ant脚本部署JavaFX应用程序,ant,javafx,Ant,Javafx,我试图用Ant为我的JavaFX应用程序生成一个可执行jar,我的jar与JavaFX打包程序生成的jar之间的区别在于后者包含com.JavaFX.main包中的类。 我如何在我的Ant脚本中告诉您也要在jar中包含这些类呢?您使用的Ant文件必须有特殊的fx任务来部署jar,而不是Ant内置的jar任务。下面是一个使用JavaFX生成jar的示例ant目标: <target name="jar" depends="compile"> <echo>Cre

我试图用Ant为我的JavaFX应用程序生成一个可执行jar,我的jar与JavaFX打包程序生成的jar之间的区别在于后者包含com.JavaFX.main包中的类。
我如何在我的Ant脚本中告诉您也要在jar中包含这些类呢?

您使用的Ant文件必须有特殊的fx任务来部署jar,而不是Ant内置的jar任务。下面是一个使用JavaFX生成jar的示例ant目标:

<target name="jar" depends="compile">
        <echo>Creating the main jar file</echo>  
        <mkdir dir="${distro.dir}" />
        <fx:jar destfile="${distro.dir}/main.jar" verbose="true">
            <fx:platform javafx="2.1+" j2se="7.0"/>
            <fx:application mainClass="${main.class}"/>

            <!-- What to include into result jar file?
                 Everything in the build tree-->
            <fileset dir="${classes.dir}"/>

            <!-- Define what auxilary resources are needed
                  These files will go into the manifest file,
                  where the classpath is defined -->
             <fx:resources>
                <fx:fileset dir="${distro.dir}" includes="main.jar"/>
                <fx:fileset dir="." includes="${lib.dir}/**" type="jar"/>
                <fx:fileset dir="." includes="."/>
            </fx:resources>

            <!-- Make some updates to the Manifest file -->
            <manifest>
               <attribute name="Implementation-Vendor" value="${app.vendor}"/>
               <attribute name="Implementation-Title" value="${app.name}"/>
               <attribute name="Implementation-Version" value="1.0"/>
            </manifest>
        </fx:jar>
    </target>

创建主jar文件

<taskdef resource="com/sun/javafx/tools/ant/antlib.xml"      
            uri="javafx:com.sun.javafx.tools.ant"
            classpath="${javafx.sdk.path}/lib/ant-javafx.jar"/>
<project name = "MyProject" default ="compile"  xmlns:fx="javafx:com.sun.javafx.tools.ant">