Basic Help with error

Exception in thread "main" java.lang.NoClassDefFoundError: Variables/class

this error comes up when i try to run simple programs that i am copying the text straight from my "teach yourself" book. here is the text of one;

class Variables {

public static void main(String[] arguments) {

final char UP = 'U';

byte initialLevel = 12;

short location = 13250;

int score = 3500100;

boolean newGame = true;

System.out.println("Level: " + initialLevel);

System.out.println("up: " + UP);

}

}

[567 byte] By [adidas4tya] at [2007-11-27 11:57:48]
# 1

Type:

java Variables

not

java Variables.class

-- your psychic friend,

Parvati

ParvatiDevia at 2007-7-29 19:16:03 > top of Java-index,Java Essentials,New To Java...
# 2

Obviously even without you telling us what the command line you used to try to run that class, I can tell you tried this:

java Variables.class

You are not to specify file names to the runtime. You need to specify class names. In this case the class name is simply Variables.

Beaten to it by another psychic...

Message was edited by:

warnerja

warnerjaa at 2007-7-29 19:16:03 > top of Java-index,Java Essentials,New To Java...
# 3

i feel stupid, thank you thank you!

adidas4tya at 2007-7-29 19:16:03 > top of Java-index,Java Essentials,New To Java...
# 4

> i feel stupid, thank you thank you!

Learning to program is all about making mistakes. One thing you'll notice about an experienced programmer who's learning another languages is his/her attention to details. It's like I learned in carpentry class: measure twice, cut once.

ParvatiDevia at 2007-7-29 19:16:03 > top of Java-index,Java Essentials,New To Java...