Apache commons: ClassNotFoundException

I'm trying to benefit from EnumeratedIntegerDistribution()out org.apache.commons.math3.distribution, as shown below.

I work with jdk7, on Windows Xp, working from the command line, in one and only project folder

I do:

  • download commons-math3-3.2 and unzip it to your folder where my java is located.
  • compile my source (no errors without errors) javac -cp commons-math3-3.2 / commons-math3-3.2.jar CheckMe.java
  • run java CheckMe

Here is a demo:

import java.lang.Math. *; import org.apache.commons.math3.distribution.EnumeratedIntegerDistribution;

public class CheckMe {

public CheckMe() {

    System.out.println("let us check it out"); 
    System.out.println(generate_rand_distribution (10));
}

private static int[] generate_rand_distribution (int count){
    int[] nums_to_generate          = new int[]    { -1,   1,    0  };
    double[] discrete_probabilities = new double[] { 0.4, 0.4, 0.2  };
    int[] samples = null;

    EnumeratedIntegerDistribution distribution = 
    new EnumeratedIntegerDistribution(nums_to_generate, discrete_probabilities);

    samples = distribution.sample (count);

    return (samples);
}   

public static void main (String args[]) { 
    System.out.println("Main: ");
    CheckMe  animation = new CheckMe();  
} 

}

However, I have:

Class NotFoundException: org.apache.commons.math3.distribution.EnumeratedIntegerDistribution on line 18 - call EnumeratedIntegerDistribution ()

If I ran, as I was just advised (below):

    java -cp   commons-math3-3.2/commons-math3-3.2.jar  CheckMe

: CheckMe

.

0
1

, . ,

java CheckMe.java 

.

java CheckMe

CheckMe - .

java -cp commons-math3-3.2/commons-math3-3.2.jar CheckMe

, CheckMe.

+2

All Articles