java.lang.NoClassDefFoundError on Netbeans 7.0

1.1k views Asked by At

Hi you can call me Kenshi. I am a highschool student trying to take a online programming class. I would ask my teacher but she almost wrecked my laptop beyond repair because she knows nothing about this. here is my problem.... A few weeks ago i typed up a program finding the surfacearea of a cube. And ever since then when ever i try and run a program it runs the cube program instead. I deleted the project and when i did i got the Java.lan.NoClassDefFoundError. I have heard that i have to delete the Cashe of the program, i had to wipe my computer (due to my teacher) and that didnt work. I followed the program instructions on the Fundamentals of Java Textbook. And when i re typed the program once i got my laptop back and running I still go the error. If you can help it would make This one Very Happy. Below i will provide the whole error code.

java.lang.NoClassDefFoundError: studentapps/StudentApps (wrong name: StudentApps/StudentApps)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:476)

Exception in thread "main" Java Result: 1 BUILD SUCCESSFUL (total time: 1 second)

Again Much appreciated!!

EDIT: This is the code of the Class its self.

package StudentApps;

import java.util.Scanner;

public class StudentApps {

public static void main(String[] args) {
Student student1 = new Student();
Student student2 = new Student();
Scanner reader = new Scanner (System.in);

String name;
int score;

System.out.print("Enter the first students Name: ");
name = reader.nextLine();
student1.setName(name);
for (int i = 1; i <= 3; i++){
    System.out.print("Enter the student's Score");
    score = reader.nextInt();
    student1.setScore(i, score);
    }
reader.nextLine();

System.out.print("Enter the second students name: ");
name = reader.nextLine();
student2.setName(name);
for (int i = 1; i <= 3; i++){
    System.out.print("Enter the student's Score");
    score = reader.nextInt();
    student2.setScore(i, score);
    }
System.out.println(student1);
System.out.println(student2);

if (student1.getHighScore() > student2.getHighScore()){
    name = student1.getName();

    score = student1.getHighScore();
}else{
    name = student2.getName();
    score = student2.getHighScore();
}
System.out.println(name + " has the highest score: " + score);

if (student1.getAverage() > student2.getAverage()){
    name = student1.getName();
    score = student1.getHighScore();
}else{
    name = student2.getName();
    score = student2.getAverage();
}
System.out.println(name + " has the highest average score: " + score);
}

}

1

There are 1 answers

2
ladar On

Hard to tell without actually seeing your code. But notice the first line:

studentapps/StudentApps (wrong name: StudentApps/StudentApps

There is studentapps and also StudentApps in first parts before the slash '/'. Don't you have somewhere this typo?