鏈接依賴我有這樣的文件夾結構:與JAR
|___main
| |___lib -> this folder contains my runnable jar file
| |___ext -> this folder contains dependency files (.jar) for the jar
|___log4j.properties -> here I have log4j.property file
我怎麼能執行JAR沒有ClassNotFoundException
或任何其他錯誤?我正在使用Eclipse Luna,這是一個Java項目。
這裏沒有足夠的信息來回答。我只能推薦你閱讀[classpath](http://docs.oracle.com/javase/7/docs/technotes/tools/windows/classpath.html)。上面提到的 – 2014-10-02 15:05:15
是文件夾結構,如果我運行java -cp是永久性的,它不會改變。 – 2014-10-02 15:09:08
您可以在jar文件中包含所有依賴項*,並且永遠不會得到任何'ClassNotFoundException'。 – Zenadix 2014-10-02 15:11:19