View Single Post
Alejandro Lanza

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

Alejandro Lanza is offline
Hello,

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:

Code:
/*
   This is a simple Java program.

   Call this file Example.java.
*/
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:

Code:
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 java.net.URLClassLoader$1.run(URLClassLoader.java:202)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
My machine is running java se 6.
Thoughts on how to fix this?
Thanks in advance!!

Alejandro
QUOTE Thanks