对于JavaFX应用程序ANT JAR文件 [英] ANT JAR file for JavaFX Application

查看:241
本文介绍了对于JavaFX应用程序ANT JAR文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经成功地使用符合脚本构建与previous的帮助。现在,我不能能为我的应用程序创建的JAR文件uisng ANT。我在build.xml中添加示例脚本。我的要求是创造我JavaFx的XYZ应用程序的简单的JAR文件。

I have successfully complied the JavaFX code using Build Script with the previous help. Now I can not able to create JAR file uisng ANT for my application. I am adding sample script in build.xml. My requirement is to create a simple JAR file of my JavaFx XYZ application.

<project name="XYZ" basedir=".">

<property name="WorkingFolder" location="XYZSourceData"/>
<property name="ClassPath" location="C:\Program Files\Oracle\JavaFX 2.2 Runtime\lib\jfxrt.jar;C:\Program Files\Java\jdk1.7.0_09\lib\ant-javafx.jar;"/>

<target name="init">
    <echo message="Java installation directory: ${java.home}"/>
    <!-- Create the time stamp -->
    <tstamp/>

    <delete dir="${WorkingFolder}/build"/>
    <delete dir="${dist}"/>

    <mkdir dir="${WorkingFolder}/CustomJars"/>
</target>



    <target name="Compilingxyz" depends="init">
        <mkdir dir="${WorkingFolder}/build"/>
        <taskdef resource="com/sun/javafx/tools/ant/antlib.xml"      
            uri="javafx:com.sun.javafx.tools.ant" classpath=".;C:\Program Files\Oracle\JavaFX 2.2 Runtime\lib\jfxrt.jar"/>
        <javac classpath="${ClassPath};${WorkingFolder}/CustomJars/*.jar;" srcdir="${WorkingFolder}/src/com/xyz" destdir="${WorkingFolder}/build"/>
</target>     

<target name="CreatingxyzJars" depends="Compilingxyz" description="generate the distribution" >
    <taskdef resource="com/sun/javafx/tools/ant/antlib.xml"      
            uri="javafx:com.sun.javafx.tools.ant" classpath="C:\Program Files\Java\jdk1.7.0_09\lib\ant-javafx.jar"/>

    <fx:jar destfile="${WorkingFolder}/CustomJars/XYZ.jar">
            <fx:application name="XYZ"
                mainClass="com.xyz.main.XYZEntryFX"/>
        <fx:resources>
                <fx:fileset dir="${WorkingFolder}/build" includes="${WorkingFolder}/libs/*.jar"/>
        </fx:resources>
        <fileset dir="${WorkingFolder}/resources"/>
     </fx:jar> 

</target>        

我收到以下错误 -

I am getting following error -

    BUILD FAILED
C:\Users\JavaUser4\Desktop\2012.12FX\build.xml:83: The prefix "fx" for element "
fx:jar" is not bound.

总时间:0秒

什么是缺少的一部分?我有Java桌面应用程序。如何创建的Java应用程序Fx的一个ANT JAR。请帮助。

What is the missing part? I have Java Desktop application. How can I create a ANT JAR for Java Fx Application. Please Help.

我正在下面的例子参考 -

I am taking reference of following example -

推荐答案

您错过了FX:在你的项目命名空间声明。而不是

You're missing the fx: namespace declaration in your project. Rather than

<project name="XYZ" basedir=".">

您需要的是这样的:

<project name="XYZ" basedir="."
     xmlns:fx="javafx:com.sun.javafx.tools.ant">

(这是你链接到文件,前一页, §12.3使用JavaFX Ant任务。

这篇关于对于JavaFX应用程序ANT JAR文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆