我是Java新手。我已經閱讀了關於指定類路徑的所有文檔。但我仍然對我的情況感到困惑。我試圖使用BuildIndex命令是語義包,特別是這個例子中的一部分,在命令行中用Java正確使用類路徑
java pitt.search.semanticvectors.BuildIndex -luceneindexpath $INDEX_MADE_ABOVE.
在這裏
的如何使用類的源代碼是在這裏https://github.com/semanticvectors/semanticvectors/wiki/InstallationInstructions#to-build-and-search-a-model
我m試圖指定類路徑,如:
java cp- {classpath} pitt.search.semanticvectors.BuildIndex -luceneindexpath $INDEX_MADE_ABOVE.
in here
但我不知道什麼類路徑應該在這裏。 。命令行應該有一個類路徑,但認爲它不應與我的項目相關,它是語義向量包的一部分。我需要克隆嗎?從這裏https://github.com/semanticvectors/semanticvectors/blob/master/src/main/java/pitt/search/semanticvectors/BuildIndex.java包的源代碼..
我的試驗中,用我的項目作爲圖片的路徑,但沒有奏效。另一個試驗是使用-jar jarName
,,得到了同樣的錯誤:Could not find or load main class pitt.search.semanticvectors.BuildIndex
。我很感謝這個幫助,因爲我很困惑,並且對此很陌生。
我是用罐子代替-cp ,,我還以爲罐子它應該jar文件路徑旁使用,,,順便說一下,在這種情況下,目錄可以在這裏? – Lelo
要執行一個Java類(在你的情況pitt.search.semanticvectors.BuildIndex),Java必須知道類的位置。如果它不在全局類路徑中,則需要在命令行參數('-cp')中指定類路徑。 通常情況下,編譯後的代碼打包在一個jar文件中(基本上只是一個zip文件)。但是,如果編譯後的代碼沒有打包到jar文件中,它將位於某個目錄中(請查看項目中的bin目錄,Eclipse會將所有已編譯的java代碼放在該目錄中) – anhquan