正确导入Apache Commons Math软件包 [英] Correctly Importing Apache Commons Math Package
问题描述
我正在尝试使用Apache Commons Math软件包中的SimplexSolver类,但是我似乎无法正确导入该软件包.以下所有情况均发生在名为"Java"的固定目录中.我下载了commons-math3-3.1.1并将解压缩后的文件夹放入"Java"目录中.
I am trying to use the SimplexSolver class in the Apache Commons Math package, but I can't seem to import the package correctly; all of the following is happening in a fixed directory called 'Java'. I downloaded commons-math3-3.1.1 and put the unzipped folder into the 'Java' directory.
以下是一些示例代码HelloWorld.java,保存在"Java"目录中:
Here is some example code, HelloWorld.java, saved in the 'Java' directory:
import org.apache.commons.math;
public class HelloWorld {
public static void main (String[] args) {
System.out.println("Hello World!");
}
}
然后我继续在终端中键入以下命令:
I then proceed to type the following command into the terminal:
javac -cp ./commons-math3-3.1.1/commons-math3-3.1.1.jar:. HelloWorld.java
我遇到以下错误:
HelloWorld.java:1: package org.apache.commons does not exist
import org.apache.commons.math;
^
1 error
我确定我误解了导入下载软件包的正确方法,我们将不胜感激.我已经尝试了导入行的变体,例如import org.apache.commons.math.*;之类的东西,但是到目前为止,它们都没有起作用.
I'm sure I'm misunderstanding the correct way to import downloaded packages, and any help would be greatly appreciated. I've tried variants of the import line, such as import org.apache.commons.math.*; and things like that, but none of them have worked so far.
提前谢谢!
推荐答案
正确的软件包名称是
org.apache.commons.math3.
这篇关于正确导入Apache Commons Math软件包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!