I am running OSX 10.4.8
I have just downloaded J2SE 5.0 Release 9 and installed it, and I have also installed Netbeans,
I have a program with the following code..
The output is the following...
Why does java not work on here?
Here is the contents of the console...
Any help would be appreciated.
I have just downloaded J2SE 5.0 Release 9 and installed it, and I have also installed Netbeans,
I have a program with the following code..
import java.util.Scanner;
/* First program for Programming2
** Revisiting basic variables and
** reading input from the keyboard
*/
public class First
{
public static void main (String args[])
{
int number1;
int number2;
double number3;
double result;
String name;
Scanner scan = new Scanner(System.in);
//ask user's name
System.out.print("Who are you? ");
name = scan.next();
System.out.println("Give me an int ");
number1 = scan.nextInt();
System.out.println("Give me another int ");
number2 = scan.nextInt();
System.out.println("Give me a double ");
number3 = scan.nextDouble();
System.out.println("Hello "+name);
result = number1 + number2 + number3;
System.out.println("three numbers added is "+result);
result = number1 * number2 * number3;
System.out.println("three numbers multiplied is "+result);
result = number3 - number2;
System.out.println("third number minus the second number is "+result);
result = number3 / number2 ;
System.out.println("third number divided by second number is "+result);
}
}
/* First program for Programming2
** Revisiting basic variables and
** reading input from the keyboard
*/
public class First
{
public static void main (String args[])
{
int number1;
int number2;
double number3;
double result;
String name;
Scanner scan = new Scanner(System.in);
//ask user's name
System.out.print("Who are you? ");
name = scan.next();
System.out.println("Give me an int ");
number1 = scan.nextInt();
System.out.println("Give me another int ");
number2 = scan.nextInt();
System.out.println("Give me a double ");
number3 = scan.nextDouble();
System.out.println("Hello "+name);
result = number1 + number2 + number3;
System.out.println("three numbers added is "+result);
result = number1 * number2 * number3;
System.out.println("three numbers multiplied is "+result);
result = number3 - number2;
System.out.println("third number minus the second number is "+result);
result = number3 / number2 ;
System.out.println("third number divided by second number is "+result);
}
}
The output is the following...
init:
deps-jar:
compile-single:
run-single:
deps-jar:
compile-single:
run-single:
Why does java not work on here?
Here is the contents of the console...
Exception in thread "main" java.lang.NoClassDefFoundError: First (wrong name: week1/First)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
Any help would be appreciated.