简体   繁体   English

正确导入Apache Commons Math软件包

[英]Correctly Importing Apache Commons Math Package

I am trying to use the SimplexSolver class in the Apache Commons Math package, but I can't seem to import the package correctly; 我正在尝试使用Apache Commons Math软件包中的SimplexSolver类,但是我似乎无法正确导入该软件包。 all of the following is happening in a fixed directory called 'Java'. 以下所有情况均发生在名为“ Java”的固定目录中。 I downloaded commons-math3-3.1.1 and put the unzipped folder into the 'Java' directory. 我下载了commons-math3-3.1.1并将解压缩后的文件夹放入“ Java”目录中。

Here is some example code, HelloWorld.java, saved in the 'Java' directory: 这是一些示例代码HelloWorld.java,保存在“ Java”目录中:

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

And I am greeted with the following error: 我收到以下错误消息:

HelloWorld.java:1: package org.apache.commons does not exist
import org.apache.commons.math;
                         ^
1 error

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.*; 我已经尝试了导入行的变体,例如import org.apache.commons.math。*; and things like that, but none of them have worked so far. 诸如此类的事情,但到目前为止,它们都没有奏效。

Thanks in advance! 提前致谢!

正确的软件包名称是

org.apache.commons.math3.

你想念3 :-)

import org.apache.commons.math3;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM