JavaC CreateProcess错误= 206,文件名或扩展名太长 [英] JavaC CreateProcess error=206, The filename or extension is too long

查看:569
本文介绍了JavaC CreateProcess错误= 206,文件名或扩展名太长的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试编译Java代码,但出现错误: 由以下原因引起:java.io.IOException:无法运行程序"C:\ jdk \ bin \ javac":CreateProcess错误= 206,文件名或扩展名太长.

I tried to compile java code, but I got the error: Caused by: java.io.IOException: Cannot run program "C:\jdk\bin\javac": 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:\Users\Administrator\.jenkins\workspace\BUILD2TEST\BUILD2TEST\WebContent\WEB-INF\lib">
                <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屋!

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