Ant run InvocationTargetException



嗨,我在ant run [java]主题中有问题,效果很好,我尝试了各种班级路径等的修改。但是没有帮助我,您能帮我吗?我在Javafx上写了我的项目,这是GUI应用程序。我的build.xml文件是:

<property name="java.home" value="/usr/local/share/Java"/>
<property name="source.dir" value="src"/>
<property name="out.dir" value="build"/>
<property name="out.dir.classes" value="${out.dir}/classes" />
<property name="out.dir.dist" value="${out.dir}/dist"/>
<property name="app.jar.name" value="TesterFX.jar"/>
<path id="classpath">
    <fileset dir="${java.home}/lib" includes="**/*.jar"/>
</path>
<target name="clean">
    <delete dir="${out.dir}"/>
</target>
<target name="init" depends="clean">
    <mkdir dir="${out.dir}"/>
    <mkdir dir="${out.dir.classes}"/>
    <mkdir dir="${out.dir.dist}"/>
</target>
<target name="compile" depends="init">
    <javac srcdir="${source.dir}" destdir="${out.dir}/classes" classpathref="classpath"
           source="1.7"
           target="1.7" />
    <copy todir="${out.dir}/classes">
        <fileset dir="${source.dir}">
            <include name="**/*.png" />
            <include name="**/*.fxml" />
            <include name="**/*.css" />
        </fileset>
    </copy>
</target>
<target name="build" depends="compile">
    <path id="fxant">
        <filelist>
            <file name="${java.home}..libant-javafx.jar"/>
            <file name="${java.home}libextjfxrt.jar"/>
        </filelist>
    </path>
    <taskdef resource="com/sun/javafx/tools/ant/antlib.xml"
             uri="javafx:com.sun.javafx.tools.ant"
             classpathref="fxant"/>
    <fx:application id="TesterFX" mainClass="sample.Main"/>
    <fx:jar destfile="${out.dir.dist}/${app.jar.name}">
        <fx:application refid="TesterFX"/>
        <manifest>
            <attribute name="Implementation-Vendor"
                       value="Thierry"/>
            <attribute name="Implementation-Title"
                       value="TesterFX"/>
            <attribute name="Implementation-Version" value="1.0"/>
        </manifest>
        <fileset dir="${out.dir.classes}"/>
    </fx:jar>
</target>
<target name="run" depends="build">
    <java jar="${out.dir.dist}/${app.jar.name}" fork="true"/>
</target>
<target name="default" depends="run">
</target>

整个异常跟踪是:

[java] Exception in thread "main" java.lang.reflect.InvocationTargetException
 [java]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 [java]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
 [java]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 [java]     at java.lang.reflect.Method.invoke(Method.java:498)
 [java]     at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
 [java] Caused by: java.lang.RuntimeException: java.lang.OutOfMemoryError: unable to create new native thread
 [java]     at com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:267)
 [java]     at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:211)
 [java]     at com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:675)
 [java]     at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:337)
 [java]     at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
 [java]     ... 5 more
 [java] Caused by: java.lang.OutOfMemoryError: unable to create new native thread
 [java]     at java.lang.Thread.start0(Native Method)
 [java]     at java.lang.Thread.start(Thread.java:717)
 [java]     at com.sun.glass.ui.gtk.GtkApplication.<init>(GtkApplication.java:76)
 [java]     at com.sun.glass.ui.gtk.GtkPlatformFactory.createApplication(GtkPlatformFactory.java:41)
 [java]     at com.sun.glass.ui.Application.run(Application.java:146)
 [java]     at com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:257)
 [java]     ... 9 more
 [java] Java Result: 1

这是堆栈跟踪所示的运行时间异常。

引起的:java.lang.outofmemoryerror:无法创建新的本机线程

检查1.如果您的公羊没有填充2.增加JVM的大小

这些应该有所帮助。

相关内容

  • 没有找到相关文章

最新更新