轉載於:http://blog.csdn.net/booknut/article/details/3947254
在匯入網友提供的Tomcat源碼工程時候出現了
The project cannot be build until build path errors are resolved
Unbound classpath variable:"a_Tomcat6-depend/ant1.7/ant.jar " in project Tomcat6
弄了一個早上才意識到錯誤出現在工程的“.classpath”檔案裡面
改檔案內容為:
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="var" path="a_Tomcat6-depend/ant1.7/ant.jar"/>
<classpathentry kind="var" path="a_Tomcat6-depend/puretls-0.95/puretls-0.95.jar"/>
<classpathentry kind="var" path="a_Tomcat6-depend/commons/common-logging1.1.1/commons-logging-1.1.1.jar"/>
<classpathentry kind="var" path="a_Tomcat6-depend/jaxrpc1.1/jaxrpc.jar"/>
<classpathentry kind="var" path="a_Tomcat6-depend/jdt3.3/org.eclipse.jdt.core_3.3.0.v_771.jar"/>
<classpathentry kind="var" path="a_Tomcat6-depend/wsdl4j-1.5.1/wsdl4j-1.5.1.jar"/>
<classpathentry kind="output" path="classes"/>
</classpath>
發現目錄裡並不存在"a_Tomcat6-depend"一檔案夾,而實際目錄為“Tomcat6/lib/ant1.7/ant.jar”。於是把該設定改為“lib/ant1.7/ant.jar”,依然報同類錯誤。於是很自然地對“.classpath”定義的方式產生了興趣,終於找到一篇高手寫的關於“eclipse下環境配置”的文章。
原來<classpathentry kind="var" path="a_Tomcat6-depend/ant1.7/ant.jar"/>這種定義方式是運用了eclipse的環境變數,換句話說a_Tomcat6-depend 應該是一個環境變數(make sense!)。
於是 Window->Refernces->Java->Build Path->Classpath Variables
定義了一個name為a_Tomcat6-depend
Then,Done.
這個問題的解決完全得益於改為高手提供資訊,這裡提供該部落格連結供路過且有興趣的coder們參考:
http://www.blogjava.net/henry1451/articles/205891.html