Making sawdust
Join Date: May 2004
Location: Minnesota
|
So I decided i wanted to tech myself some OOP and i picked up a book on java (head first series).
First thing i try to compile is a very simple "Hello world" type app (code below). It compiles without error, however, i get an exception thrown at me when i try to execute it. Source code for class: Code:
public class MyFirstApp {
public static void main (String[] args) {
System.out.print("I Rule!");
System.out.print("The World!");
}
} error message displayed upon execution:Code:
Exception in thread "main" java.lang.NoClassDefFoundError: MyFirstApp/class i know my java is up to date, but i still can't figure out what is wrong. Any suggestions?EDIT: *smacks forhead onto desk* had i read the book a little more carefully, i would have seen that i need to type "java MyFirstApp" to execute it, not "java MyFirstApp.class" sorry for the disruption folks |
quote |
Selfish Heathen
Join Date: May 2004
Location: Zone of Pain
|
How are you trying to execute it?
It looks like you're doing this: Code:
java MyFirstApp.class You should be doing this:Code:
java MyFirstApp |
quote |
Making sawdust
Join Date: May 2004
Location: Minnesota
|
doh! brad beat me to my edit!
|
quote |
Selfish Heathen
Join Date: May 2004
Location: Zone of Pain
|
Glad to be of service.
|
quote |
Posting Rules | Navigation |
|
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Compiling & Running Java? (on OS X) | MagSafe | Programmer's Nook | 6 | 2006-05-06 09:39 |
Need help with Java (Brad?) | Luca | Genius Bar | 21 | 2006-03-25 19:46 |
Athletes that you think might take steroids | Messiahtosh | AppleOutsider | 42 | 2006-03-23 16:25 |
File association to app was screwed.. what do you think? | Koodari | Genius Bar | 0 | 2005-09-17 05:10 |
iPod app, and new iStore app needed | yoda_four | Speculation and Rumors | 6 | 2004-12-30 14:49 |