JavaC CreateProcess 错误=206,文件名或扩展名太长 [英] JavaC CreateProcess error=206, The filename or extension is too long
问题描述
我尝试编译 java 代码,但出现错误:引起:java.io.IOException: 无法运行程序 "C:jdkinjavac": CreateProcess error=206, The filename or extension is too long.
I tried to compile java code, but I got the error: Caused by: java.io.IOException: Cannot run program "C:jdkinjavac": CreateProcess error=206, The filename or extension is too long.
这是我的构建文件的内容:
This is the content of my build file:
<path id="was.runtime">
<!-- <fileset dir="C:UsersAdministrator.jenkinsworkspaceBUILD2TESTBUILD2TESTWebContentWEB-INFlib">
<include name="*.jar"/>
</fileset> -->
<fileset dir="${copy.from.path}/WebContent/WEB-INF/lib">
<include name="*.jar" />
</fileset>
<fileset dir="${was_home}/lib">
<include name="**/*.jar" />
</fileset>
<fileset dir="${was_home}/plugins">
<include name="**/*.jar" />
</fileset>
</path>
<property name="was_cp" value="${toString:was.runtime}" />
<javac fork="yes" executable="${java.home}/bin/javac" compiler="javac1.6" includeantruntime="false" encoding="utf-8" srcdir="${workspace}/${project.name}/src" destdir="${workspace}/${project.name}/WebContent/WEB-INF/classes" classpath="${was_cp}">
</javac>
我想可能是我的类路径:${was_cp} 太长了.我怎样才能解决这个问题 ?
I think maybe my classpath: ${was_cp} is too long. How can I fix this ?
推荐答案
问题不在于您的 classpath
太大.这是你正在转换成一个巨大的字符串.只需使用 classpathref
属性代替:
The problem isn't that your classpath
is too large. It's that you're converting into one gigantic string. Simply use the classpathref
attribute instead:
<path id="was.runtime">
<fileset dir="${copy.from.path}/WebContent/WEB-INF/lib">
<include name="*.jar" />
</fileset>
<fileset dir="${was_home}/lib">
<include name="**/*.jar" />
</fileset>
<fileset dir="${was_home}/plugins">
<include name="**/*.jar" />
</fileset>
</path>
<javac
fork="yes"
executable="${java.home}/bin/javac"
compiler="javac1.6"
includeantruntime="false"
encoding="utf-8"
srcdir="${workspace}/${project.name}/src"
destdir="${workspace}/${project.name}/WebContent/WEB-INF/classes"
classpathref="was.runtime"
/>
这篇关于JavaC CreateProcess 错误=206,文件名或扩展名太长的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!