Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Nov 8th, 2005, 12:16 PM   #1
Prm753
Professional Programmer
 
Prm753's Avatar
 
Join Date: Oct 2005
Location: United States
Posts: 447
Rep Power: 3 Prm753 is on a distinguished road
Send a message via AIM to Prm753 Send a message via MSN to Prm753
Beginning to lean Java...

Hello all.

As you might have seen from the other post, I have decided to learn Java.
I downloaded jEdit, found a tutorial from Sun, typed in my code:
class HelloWorldApp 
{
    public static void main(String[] args) 
    {
        System.out.println("Hello World!"); //Display the string.
    }
}

and of course there is an error:

java.lang.NoClassDefFoundError: helloworld
Exception in thread "main" Process java exited with code 1

This is compiling with the -java setting on the compiler.
Windows can't find the -javac setting.

Can someone tell me what I'm not doing in the compiler to make this work?
I'm almost certain the code is correct.

Thanks.
__________________
The world's first athletic computer geek!
The home of PrProgramsStudios
How not to post a question: <-- Please don't reply
Prm753 is offline   Reply With Quote
Old Nov 8th, 2005, 12:19 PM   #2
andro
Professional Programmer
 
Join Date: Oct 2005
Location: California
Posts: 294
Rep Power: 3 andro is on a distinguished road
Send a message via AIM to andro
To compile it, at the command line type this:
javac HelloWorldApp.java

To run it:
java HelloWorldApp

If you get a "command not recognized" or something similiar for javac you probably haven't installed the JDK yet. Go get it from sun's website
andro is offline   Reply With Quote
Old Nov 8th, 2005, 12:20 PM   #3
Polyphemus_
Expert Programmer
 
Polyphemus_'s Avatar
 
Join Date: Aug 2005
Location: Rotterdam, the Netherlands
Posts: 942
Rep Power: 4 Polyphemus_ is on a distinguished road
I've noticed several mistakes.. To start, you do need javac to compile. Secondly, the filename of your sourcefile has to be equal to the name of the class it contains.
You have to install the JDK (Java Development Kit) to get javac.
Polyphemus_ is offline   Reply With Quote
Old Nov 8th, 2005, 12:29 PM   #4
Prm753
Professional Programmer
 
Prm753's Avatar
 
Join Date: Oct 2005
Location: United States
Posts: 447
Rep Power: 3 Prm753 is on a distinguished road
Send a message via AIM to Prm753 Send a message via MSN to Prm753
Aha, I see now. I will download the JDK sometime, but DSL lite only gets 30kb a sec and a 50 mb download will be 25 mins or so, and I don't feel like doing that now lol.
__________________
The world's first athletic computer geek!
The home of PrProgramsStudios
How not to post a question: <-- Please don't reply
Prm753 is offline   Reply With Quote
Old Nov 8th, 2005, 12:40 PM   #5
peace_of_mind
Professional Programmer
 
peace_of_mind's Avatar
 
Join Date: Sep 2004
Location: Hell if I know most of the time
Posts: 439
Rep Power: 4 peace_of_mind is on a distinguished road
Send a message via MSN to peace_of_mind Send a message via Yahoo to peace_of_mind
Quote:
Originally Posted by Prm753
Aha, I see now. I will download the JDK sometime, but DSL lite only gets 30kb a sec and a 50 mb download will be 25 mins or so, and I don't feel like doing that now lol.
Drop to your knees and thank the good Lord above that you don't have dial-up, my good man. Always look on the bright side of life, (whistling) /montypython
__________________
Amateurs built the ark
Professionals built the Titanic

peace_of_mind is offline   Reply With Quote
Old Nov 8th, 2005, 1:07 PM   #6
Prm753
Professional Programmer
 
Prm753's Avatar
 
Join Date: Oct 2005
Location: United States
Posts: 447
Rep Power: 3 Prm753 is on a distinguished road
Send a message via AIM to Prm753 Send a message via MSN to Prm753
Well, my parents (after me bugging them for years) finally switched over to dsl lite from dial-up, so I know what it's like...
__________________
The world's first athletic computer geek!
The home of PrProgramsStudios
How not to post a question: <-- Please don't reply
Prm753 is offline   Reply With Quote
Old Nov 8th, 2005, 1:11 PM   #7
jamesdman
Newbie
 
Join Date: Apr 2005
Location: NC,USA
Posts: 17
Rep Power: 0 jamesdman is on a distinguished road
OMG..Then you must not be to serious about learning it.I have dial-up and I downloaded it in my sleep and part of the next day.I'm also a novice but I guess I want to learn it a bit more then you.
jamesdman is offline   Reply With Quote
Old Nov 8th, 2005, 1:15 PM   #8
Prm753
Professional Programmer
 
Prm753's Avatar
 
Join Date: Oct 2005
Location: United States
Posts: 447
Rep Power: 3 Prm753 is on a distinguished road
Send a message via AIM to Prm753 Send a message via MSN to Prm753
I'll probaly do it tonight, when my mom is done with the pc. I don't want to slow down my download and her surfing. I am serious about learning Java.
__________________
The world's first athletic computer geek!
The home of PrProgramsStudios
How not to post a question: <-- Please don't reply
Prm753 is offline   Reply With Quote
Old Nov 8th, 2005, 5:38 PM   #9
Lich
Professional Programmer
 
Lich's Avatar
 
Join Date: May 2005
Location: Detroit
Posts: 254
Rep Power: 4 Lich is on a distinguished road
Send a message via AIM to Lich Send a message via MSN to Lich
Download java SDK/Netbeans from Sun and the Eclipse SDK. Get this and the rest is up to you.
__________________
--John Cruz
Web Developer
www.cruzweb.net
Lich is offline   Reply With Quote
Old Nov 8th, 2005, 6:22 PM   #10
crawforddavid2006
Expert Programmer
 
crawforddavid2006's Avatar
 
Join Date: Apr 2005
Location: Not sure yet
Posts: 579
Rep Power: 0 crawforddavid2006 is an unknown quantity at this point
Send a message via AIM to crawforddavid2006 Send a message via MSN to crawforddavid2006
Try this
public class HelloWorld
{
    public static void main(String[] args)
    {
        System.out.println("Hello World!");
    }
}
crawforddavid2006 is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 4:05 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC