我在當前目錄中有一些jar,都需要在類路徑中,所以我想使用通配符約定來處理classpath。該命令行是:在類路徑中使用通配符調用java失敗
java.exe -classpath * org.python.util.jython args
但是我得到這個錯誤
Exception in thread "main" java.lang.NoClassDefFoundError: G:/repo/builds/jars/edu_mines_jtk/jar
Caused by: java.lang.ClassNotFoundException: G:.repo.builds.jars.edu_mines_jtk.jar
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: G:/repo/builds/jars/edu_mines_jtk.jar. Program will exit.
如果我手動展開通配符,與
然後,它按預期工作。
我的通配符有什麼問題?
爲Win7的64位JRE 25年6月1日
[使用通配符作爲類路徑?](http://stackoverflow.com/questions/1237093/using-wildcard-for-classpath) – 2011-05-30 17:50:27
閱讀[本文](http://download.oracle.com /javase/6/docs/technotes/tools/windows/classpath.html)來設置類路徑。通配符的工作,只需提及'/*'。對於當前目錄,包含'。'字符。 –
2011-05-30 17:51:39
@VineetReynolds :(複製)不,我的更具體。 – CharlesB 2011-05-30 17:56:57