débutant : java.lang.NoClassDefFoundError
J'ai repris le code source fournit avec un tutorial, et il me renvoie l'erreur suivante : java.lang.NoClassDefFoundError
Exception in thread "main"
Pourtant la classe main est definie, ou est le noeud svp?
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| class Chocos { // début du programme
static String mangeur = "Gargantua"; // cette variable est statique. portée = tout le programme
public static void main(String args[]) { // début de la méthode main()
int nombreDeChocolats = 40; // cette variable est non-statique. portée = ce bloc main()
System.out.println(mangeur + " a " + nombreDeChocolats + " chocolats"); // affichage
System.out.println("Il en mange 3 d'un coup");
nombreDeChocolats = nombreDeChocolats - 3; // opération de changement de la valeur de la variable
System.out.println("Il en reste:"+nombreDeChocolats);
System.out.println("Il renverse la boite, 15 sont perdus");
nombreDeChocolats = nombreDeChocolats - 15;
System.out.println("Il en reste:"+nombreDeChocolats);
System.out.println("Pour se venger," + mangeur + " finit la boite");
nombreDeChocolats = nombreDeChocolats - 22;
System.out.println("Il en reste:"+nombreDeChocolats);
System.out.println("Mais " + mangeur + " a encore une boite...");
}
} |
PS : le nom de mon programme est HelloWorld.java