I was wondering if there is a good statistical library for Java. I used to use colt from CERN but it does not provide a good weighted sampling. So I usually use MATLAB Java Builder and export everything to Java afterward. Any thoughts or insights?

8 accepted

What about the Apache Commons Math Library? It has a statistics package.


I asked a similar question over here. Some of the leading contenders in those responses include Apache Commons Math, Java Numerics (NIST), colt, and MATLIB. Currently, we're using Apache Commons Math but our penetration there isn't very deep (and we are almost certainly not using it in the same way as you would).


You can also use R and call it from Java with JRI. See this related post.

The downside is the learning curve, but it's well worth the effort in my opinion. As the wikipedia article states: "The R language has become a de facto standard among statisticians for the development of statistical software, and is widely used for statistical software development and data analysis."

You can also follow along with the SO postings on R. See this post as an example for learning the language.


jHepWork is a good statistical package in Java. Look at http://jwork.org/jhepwork/ It has good documentation, graphics and IDE (seems even for small-screen devices)


you might want to look into Octave -- I don't have much experience with it, it's "kind of" compatible with MATLAB and I believe it has the ability to be called from Java. (it's GPL so be sure to check whether your use of it through Java imposes GPL-ness onto your application. I would guess not but do your due diligence.)


You may try SuanShu, a Java statistics library. They have quite a good coverage in statistics.


After working on different libraries I am still using MATLAB as my main statistical library and just convert everything to JAVA