使用ant构建JavaFX应用程序

时间:2015-10-27 15:49:17

标签: ant javafx build.xml

我很长时间都在寻找解决我的问题的方法,我找不到任何可以帮助我的东西,我需要从我的应用程序创建exe,当我编译它时工作,但是当我尝试生成时它给了我一个例外:

  guide me to correct way and which is the good way to share data on this both messegner.

的build.xml

Caused by: java.lang.IllegalStateException: Location is not set.
        at javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
        at javafx.fxml.FXMLLoader.load(Unknown Source)
        at br.nivelamento.MainApp.initRootLayout(Unknown Source)
        at br.nivelamento.MainApp.start(Unknown Source)
        at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$163
(Unknown Source)

MainApp.class

<project name="Nivelamento" default="do-deploy" basedir="." xmlns:fx="javafx:com.sun.javafx.tools.ant">
    <target name="init-fx-tasks">
        <path id="fxant">
            <filelist>
                <file name="${java.home}\..\lib\ant-javafx.jar" />
                <file name="${java.home}\lib\jfxrt.jar" />
            </filelist>
        </path>

        <taskdef resource="com/sun/javafx/tools/ant/antlib.xml" uri="javafx:com.sun.javafx.tools.ant" classpathref="fxant" />
    </target>
<fx:resources id="appRes">
            <fx:fileset dir="dist" includes="Nivelamento.jar" />
            <fx:fileset dir="dist" includes="libs/*" />
        </fx:resources>

Folders Tree

谁能帮助我吗? 感谢

1 个答案:

答案 0 :(得分:0)

经过多次尝试,我终于成功了,错误就在了 loader.setLocation(MainApp.class.getResource(&#34; view / RootLayout.fxml&#34;)); RootLayout.fxml看到的不是真名,root5是真的名是rootLayout.fxml修复大写字符解决了我的问题