If you want to use a more generic external tool for this, use Octave. I think it's more suitable for these kind of things. If not, take a look to:
Logistic Regression in Java
Specifically:
http://commons.apache.org/math/userguide/overview.html
or
http://mallet.cs.umass.edu/optimization.php
http://mahout.apache.org/