User Name
Password
AppleNova Forums » Programmer's Nook »

Can't run simplest Java app!


Register Members List Calendar Search FAQ Posting Guidelines
Can't run simplest Java app!
Thread Tools
ThunderPoit
Captain Potatoman
 
Join Date: May 2004
Location: Saint Paul
 
2006-11-05, 23:48

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
Brad
Selfish Heathen
 
Join Date: May 2004
Location: Zone of Pain
 
2006-11-05, 23:51

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
ThunderPoit
Captain Potatoman
 
Join Date: May 2004
Location: Saint Paul
 
2006-11-05, 23:51

doh! brad beat me to my edit!
  quote
Brad
Selfish Heathen
 
Join Date: May 2004
Location: Zone of Pain
 
2006-11-05, 23:52

Glad to be of service.
  quote
Posting Rules Navigation
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Post Reply

Forum Jump
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


« Previous Thread | Next Thread »

All times are GMT -5. The time now is 00:51.


Powered by vBulletin®
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.
Copyright ©2004 - 2021, AppleNova