Ben Gorman
Ben Gorman

Reputation: 1

How to correctly import from apache commons in Java

First of all, forgive my poor programming skills.
I recently downloaded commons math 2.2, which came with 3 .jar files: commons-math-2.2-javadoc.jar commons-math-2.2-sources.jar commons-math-2.2.jar

I want to use the normal distribution methods but I don't know how to get access to them. http://commons.apache.org/math/api-2.1/index.html

I'm using drJava on mac. What import or package statements do I need? Do I need to change anything in the drJava preferences? Any insight would be greatly appreciated. Thanks

Upvotes: 0

Views: 4181

Answers (1)

Bozho
Bozho

Reputation: 597372

  • add the commons-math-2.2.jar to the classpath
  • import whichever class you need: import org.apache.commons.math.* (avoid the star though - list all the classes the you import. A good IDE should offer you to organize your imports)

Upvotes: 2

Related Questions