在Ubuntu中为Java安装Common Math库 [英] Install commons math library for java in Ubuntu

查看:172
本文介绍了在Ubuntu中为Java安装Common Math库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我已经寻找了一段时间,发现我需要导入

So I've been looking for a while, and found that I need to import the

org.apache.commons.math3.util.ArithmeticUtils

我正在编写的Java程序中的

库.现在,这是我的第一个Java程序,我不知道该如何使用该库.

library in a Java program I'm writing. Now this is my first Java program, and I can't figure out how to use the library.

我在这里错过了什么吗?使用命令时是否需要附加选项?

Am I missing something here? Do I need to attach an option when I'm using the command?

javac MyProgramNameGoesHere.java -something(?)

还是我需要将库软件包安装到一些特殊的地方?

Or is there some special place where I need to install the the library package to?

我也使用gEdit和bash终端(而不是IDE)进行此操作.

I am also doing this with gEdit and the bash terminal, not an IDE.

如上所述,我正在使用Ubuntu,因此,如果有一些我可以从中安装它的存储库,或者很高兴必须手动下载,我应该把它放在哪里?

As stated above I am using Ubuntu, so if there is some repository that I can install it from that would be nice to know of, or if I have to manually download it, where do I put it?

推荐答案

要安装Apache Commons,请使用:

To install Apache Commons use:

sudo apt-get install libcommons-math-java

将类路径设置为包含您正在使用的库的任何目录.像这样:

Set the classpath to whichever directory contains the library you are using. Something like:

javac -classpath .:/library/directory/path/ MyProgram.java

运行man javac以获取更多信息.

Run man javac for more information.

这篇关于在Ubuntu中为Java安装Common Math库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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