今天發(fā)現(xiàn)把jar文件或.class文件放在系統(tǒng)配置的CLASSPATH目錄下,然而在eclipse的工程中卻是無法加載的(通過ClassLoader去加載相應(yīng)的類)。最后我發(fā)現(xiàn)eclipse應(yīng)該是重新設(shè)置了CLASSPATH的值了,也正因為這樣它才能運行其bin目錄下的文件。如打開工程目錄下的.classpath文件:
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="lib" path="/DomainInterfaces/bin"/>
<classpathentry kind="output" path="bin"/>
</classpath>
然而如果加入一下內(nèi)容:
<classpathentry kind="lib" path="E:\\CodeRepository\\Java\\ExtClassPath" />
重啟eclipse,就可以正確的加載CLASSPATH中的內(nèi)容了。
2011-09-16