View Single Post
Alejandro Lanza

Member Since: Jan 22, 2012
Posts: 5
Alejandro Lanza is on a distinguished road

Alejandro Lanza is offline

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: 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:

   This is a simple Java program.

   Call this file
class Example {
  // A Java program begins with a call to main().
  public static void main(String args[]) {
    System.out.println("Java drives the Web.");
the error i get is:

Ales-MacBook:~ MacBook$ java /Users/MacBook/Documents/Java_coding/Example
Exception in thread "main" java.lang.NoClassDefFoundError: /Users/MacBook/Documents/Java_coding/Example
Caused by: java.lang.ClassNotFoundException: .Users.MacBook.Documents.Java_coding.Example
	at Method)
	at java.lang.ClassLoader.loadClass(
	at sun.misc.Launcher$AppClassLoader.loadClass(
	at java.lang.ClassLoader.loadClass(
My machine is running java se 6.
Thoughts on how to fix this?
Thanks in advance!!

QUOTE Thanks