Forums
New posts
Articles
Product Reviews
Policies
FAQ
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Menu
Log in
Register
Install the app
Install
Forums
macOS & iOS Developer Playground
macOS - Development and Darwin
Learning java on the mac, need help with error
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Alejandro Lanza" data-source="post: 1361668" data-attributes="member: 234852"><p>Hello,</p><p></p><p>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: <a href="http://www.amazon.com/Java-Beginners-Guide-Herbert-Schildt/dp/0071606327?tag=macforums0e4-20&tag=macforums0e4-20" target="_blank">Amazon.com: Java, A Beginner's Guide, 5th Edition (9780071606325): Herbert Schildt: Books</a> . 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. </p><p>However i can't run even the first example of the book on OS X (10.6.8). I'm able to compile it:</p><p></p><p>[CODE]/*</p><p> This is a simple Java program.</p><p></p><p> Call this file Example.java.</p><p>*/</p><p>class Example {</p><p> // A Java program begins with a call to main().</p><p> public static void main(String args[]) {</p><p> System.out.println("Java drives the Web.");</p><p> }</p><p>}[/CODE]</p><p></p><p>the error i get is:</p><p></p><p>[CODE]</p><p>Ales-MacBook:~ MacBook$ java /Users/MacBook/Documents/Java_coding/Example</p><p>Exception in thread "main" java.lang.NoClassDefFoundError: /Users/MacBook/Documents/Java_coding/Example</p><p>Caused by: java.lang.ClassNotFoundException: .Users.MacBook.Documents.Java_coding.Example</p><p> at java.net.URLClassLoader$1.run(URLClassLoader.java:202)</p><p> at java.security.AccessController.doPrivileged(Native Method)</p><p> at java.net.URLClassLoader.findClass(URLClassLoader.java:190)</p><p> at java.lang.ClassLoader.loadClass(ClassLoader.java:306)</p><p> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)</p><p> at java.lang.ClassLoader.loadClass(ClassLoader.java:247)</p><p>[/CODE]</p><p></p><p>My machine is running java se 6.</p><p>Thoughts on how to fix this?</p><p>Thanks in advance!!</p><p></p><p>Alejandro</p></blockquote><p></p>
[QUOTE="Alejandro Lanza, post: 1361668, member: 234852"] 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: [URL='http://www.amazon.com/Java-Beginners-Guide-Herbert-Schildt/dp/0071606327?tag=macforums0e4-20&tag=macforums0e4-20']Amazon.com: Java, A Beginner's Guide, 5th Edition (9780071606325): Herbert Schildt: Books[/url] . 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."); } }[/CODE] 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) [/CODE] My machine is running java se 6. Thoughts on how to fix this? Thanks in advance!! Alejandro [/QUOTE]
Verification
Post reply
Forums
macOS & iOS Developer Playground
macOS - Development and Darwin
Learning java on the mac, need help with error
Top