Here is my code. This should print out a random number, but it instead gives
me a loverly exception:
"exception in thread "main" java.lang.NoClassDefFoundError: Merge/Java"
Please help!!
import java.io.*;
import java.util.Random;
class Merge {
public static void main(String[] arg) {
Random r = new Random();
for (int i=0; i<10; i++) {
System.out.println(50+r.nextInt()%50);
}
System.out.println("Done.");
}
}
04-30-2001, 11:22 AM
Paul Clapham
Re: random numbers
Try this:
java Merge
instead of this:
java Merge.java
PC2
"max" <mntf398@aol.com> wrote in message news:3aecabd6$1@news.devx.com...
>
> Here is my code. This should print out a random number, but it instead
gives
> me a loverly exception:
> "exception in thread "main" java.lang.NoClassDefFoundError: Merge/Java"
> Please help!!
>
>
>
> import java.io.*;
> import java.util.Random;
>
> class Merge {
>
> public static void main(String[] arg) {
> Random r = new Random();
> for (int i=0; i<10; i++) {
> System.out.println(50+r.nextInt()%50);
> }
> System.out.println("Done.");
> }
>
> }
04-30-2001, 03:08 PM
Mike Petitjean
Re: random numbers
You may also need to set the classpath on the command line. For example
if your Merge.class file is in C:\Temp\ the on the command line type: java
-classpath C:\Temp\ Merge
"max" <mntf398@aol.com> wrote:
>
>Here is my code. This should print out a random number, but it instead
gives
>me a loverly exception:
>"exception in thread "main" java.lang.NoClassDefFoundError: Merge/Java"
>Please help!!
>
>
>
>import java.io.*;
>import java.util.Random;
>
>class Merge {
>
> public static void main(String[] arg) {
> Random r = new Random();
> for (int i=0; i<10; i++) {
> System.out.println(50+r.nextInt()%50);
> }
> System.out.println("Done.");
> }
>
>}