正确导入 Apache Commons Math 包 [英] Correctly Importing Apache Commons Math Package

查看:66
本文介绍了正确导入 Apache Commons Math 包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆