You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Patrick Meyer <me...@virginia.edu> on 2009/06/11 18:46:25 UTC
Re: [math] NormalDistributionImpl and NoClassDefFoundError:, MathException
> I am using the following code in a method that catches and throws=20
> org.apache.commons.math.MathException.
>=20
> NormalDistributionImpl normal =3D new NormalDistributionImpl();
> double invNorm =3D normal.inverseCumulativeProbability(itemDifficulty);
>=20
> I import the class using
>=20
> import org.apache.commons.math.MathException;
>=20
> but when I compile and run my code I get this error message=20
> java.lang.NoClassDefFoundError: org/apache/commons/math/MathException
>=20
> Any ideas what is happening? With my import statement, it seems like I
>=20
> should not be getting this error.
Do you have the commons-math jar in your classpath at runtime ?
Luc
I am using Netbeans and I have added the commons-math jar as a library. Is that the same thing?
The following simple test case works fine, but the complete application produce the error.
package test;
import org.apache.commons.math.MathException;
import org.apache.commons.math.distribution.NormalDistributionImpl;
/**
*
* @author meyerjp
*/
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
NormalDistributionImpl normal = new NormalDistributionImpl(0.0,1.0);
try{
double invNorm = normal.inverseCumulativeProbability(0.4);
System.out.println(invNorm);
}catch(MathException ex){
ex.printStackTrace();
}
}
}