![](/img/trans.png)
[英]“error: package org.apache.commons.math3.random does not exist”?
[英]error: package org.apache.commons.math.distribution does not exist
我試圖運行一個項目,但無法運行 java 文件 Utility.java。 它不能在下面的語句中導入包。
import org.apache.commons.math.distribution.*;
由於我對 cp 中應該包含哪個路徑來執行 jar 文件感到困惑,因此我嘗試使用 2 個路徑命令
root@vidhi-VirtualBox:/home/vidhi/Downloads/explorerChain/explorerchain-master# javac -cp "/Downloads/explorerChain/explorerchain-master/commons-math-1.2/commons-math-1.2.jar" Utility.java
root@vidhi-VirtualBox:/home/vidhi/Downloads/explorerChain/explorerchain-master# javac -cp "/commons-math-1.2/commons-math-1.2.jar" Utility.java
據我所知,文件位置有誤。 PS我是Java初學者。 操作系統是 ubuntu
按照以下步驟編譯和執行您的獨立 java 程序。
我想您的target-directory = /home/vidhi/Downloads/explorerChain/explorerchain-master
您將在其中執行代碼。
將 jar 文件commons-math-1.2.jar
到位置target-directory
。
Command : # cp /source-directory/commons-math-1.2.jar target-directory/
接下來轉到目標目錄。
Command : # cd <target-directory>
接下來編譯你的java文件。 :
Command : # javac -cp commons-math-1.2.jar . Utility.java
接下來運行你編譯的java文件:
Command : # java Utility
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.