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:
I think maybe my classpath: ${was_cp} is too long. How can I fix this ?
解决方案
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:
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"
/>
博客内容讲述了在尝试编译Java代码时遇到的IOException,问题根源在于将类路径转换为一个巨大的字符串。解决方案是使用classpathref属性而非将类路径转化为字符串,从而避免创建过程中的文件名或扩展名过长的问题。
9948

被折叠的 条评论
为什么被折叠?



