Learning java on the mac, need help with error

First post here and looking forward to exchanging good knowledge. I've decided to learn to program and have started with java, i'm using this book here: Amazon.com: Java, A Beginner's Guide, 5th Edition (9780071606325): Herbert Schildt: Books . I have a ˜2007 macbook that also loads xp through bootcamp and also virtualbox and haven't had issues doing the examples of the book on that OS.
However i can't run even the first example of the book on OS X (10.6.8). I'm able to compile it:

Compiles and runs fine here. That's also the most basic app you could possibly write so it's not as if it's some fancy feature causing problems (you would have found out if this was the case at compile time).

The java.lang.NoClassDefFoundError exception is thrown when the class you specified isn't found. In other words, there's no Example.class file in /Users/MacBook/Documents/Java_coding/. Check your directories and try again.

You could make the opposite argument that Eclipse is bloated and overkill for most novice programmers. I used it for a while for Python development only to return to a nice simple text editor. It's all a matter of preference I suppose.

hm, perhaps. To be honest I've tried very few IDE for java - the two that really pop in mind is eclipse and netbeans. But I strongly agree with you - it is a matter of preference I guess my point was that coding with IDE is better than writing in a text-editor and compiling it through terminal, which is what OP is doing.

Thanks for the suggestion Tonk. I had it in the back of my mind to test netbeans (wasn't aware of eclipse), but at this point in time i had not felt the need to do so. To be honest i didn't know what an IDE was until a few days ago but my reasoning at this point is to focus on what this book teaches and keep the rest as simple as possible.
And Vansmith thanks for the input on this subject too!

An IDE might be a nice addition to your process. They aren't overly complicated (at least not the basic stuff) and you will get simple access to the JDK through a GUI along with project management. It might not hurt to take a look since NetBeans and Eclipse are free.

No worries, just the thing is - it might be easy to write simple stuff in text editor, but it will be a hassle to write slightly more complicated stuff that involves multiple classes. I mean, when you're gonna have 20 classes or more -> have fun with plain text editors and compilers in terminal Thus, why not spend a little time now and learn about about IDE and start getting use to it? If you're decide to go further into development - that will save you so much time in future. If all you want to write simple stuff just for the fun of it -> yeah, you don't need to worry about IDE at all then. Again, IMHO

Absolutely. Managing projects with multiple source files can be tedious in a simple text editor and that will be where an IDE shines. For a beginner though, it might be too complex (especially if the book doesn't use one).