Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install commons math library for java in Ubuntu

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

org.apache.commons.math3.util.ArithmeticUtils

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?

Edit::

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

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?

like image 983
Tropical_Peach Avatar asked Nov 21 '25 04:11

Tropical_Peach


1 Answers

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

Run man javac for more information.

like image 147
Segmented Avatar answered Nov 22 '25 18:11

Segmented



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!