Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to import correctly the commons.apache.math libraries for my own project

I want to use the commons.apache.maths classes for my own project but I don't know how to correctly import them into eclipse. I have visited the download page for the package mentioned above http://commons.apache.org/math/download_math.cgi but I don't know if the jar file which i want to import is on the binaries zip files or the source zip files. I tried the binaries ones first and when I do the import i just get a list of empty packages. Could somebody who knows how to do a correct import please show me how to do it?

What i am doing at the moment i am downloading the zip file from the link above, extracting it and than right-click my project->properties->Java Build Path->Libraries->Add External Jars. My issue is i don't know which jars to add.

Thanks in advance. Arlind.

like image 321
Jetnor Avatar asked Jan 29 '11 22:01

Jetnor


2 Answers

You need to import this way.

import org.apache.commons.math

You can add the zip file in your build path or extract the jar files from the zip and add it to the build path. For example to add 2.1 of apache math you need this zip file commons-math-2.1.zip or extract commons-math-2.1.jar from the zip file and add it to your eclipse build path.

Another trick is - if you have the jar files or zip file added in your build path in eclipse then do ctrl+shift+o and eclipse will automatically import the packages for you.

like image 141
CoolBeans Avatar answered Oct 06 '22 23:10

CoolBeans


There is commons-math-2.1.jar in the zip - add this to your project

like image 33
Bozho Avatar answered Oct 07 '22 00:10

Bozho