小编För*_*ren的帖子

使用Ant部署带引用的jar的JavaFX 2应用程序

我编写了一个JavaFx 2应用程序(在Windows平台上使用Eclipse),现在我想将它部署到"可点击"的jar文件中.我的应用程序使用来自单独jar文件的资源代码(在Eclipse中,此资源代码是与JavaFx应用程序项目分开的项目).

使用我的Ant build.xml,我编译了应用程序和资源代码的代码,并创建了两个jar文件:

  1. fxdemo.jar - 我的JavaFx应用程序代码的jar
  2. guifw.jar - JavaFx应用程序引用的资源代码的jar.

作为最后一步(我想),使用JavaFX Ant任务,我想将这两个jar文件捆绑到一个启动我的JavaFX应用程序的"可点击"jar中.我尝试使用以下从build.xml中提取的内容.

<target name="deployFx" depends="fxdemo.jar" description="Releases FxDemo">
    <taskdef resource="com/sun/javafx/tools/ant/antlib.xml"      
              uri="javafx:com.sun.javafx.tools.ant"
              classpath=".:${fxgui.javaHome}\lib\ant-javafx.jar"/>

    <copy file="${fxgui.lib_guifw_path}" tofile="delivery/lib/guifw.jar"/>          

    <fx:application id="FxDemoGUI" name="Fx Demo GUI" MainClass="com.demo.main.MainGUI"/>

    <fx:resources id="jars">
        <fx:fileset dir="delivery/lib" includes="fxdemo.jar"/>
        <fx:fileset dir="delivery/lib" includes="guifw.jar"/>
    </fx:resources>

    <fx:jar destfile="deploy/fxDemoGui.jar">
        <!-- Define what to launch  -->
        <fx:application refid="FxDemoGUI"/>

        <fx:platform javafx="2.1+">
            <fx:jvmarg value="-Xms32m"/>
            <fx:jvmarg value="-Xmx32m"/>
            <property name="com.util.fxguifw.setup" value="com/util/fxguifw/demo/demo.properties"/>
            <property name="user.language" value="en"/>
            <property name="user.country" value="GB"/>
            <property name="CSS_ID" value="NIGHT"/>
        </fx:platform>

        <fx:resources>
            <fx:fileset dir="delivery/lib" includes="fxdemo.jar"/>
            <fx:fileset dir="delivery/lib" includes="guifw.jar"/>
        </fx:resources> …
Run Code Online (Sandbox Code Playgroud)

ant deployment executable-jar javafx-2

7
推荐指数
1
解决办法
4161
查看次数

标签 统计

ant ×1

deployment ×1

executable-jar ×1

javafx-2 ×1