![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Professional Programmer
|
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 |
|
|
|
|
|
#2 |
|
Professional Programmer
|
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 ![]() |
|
|
|
|
|
#3 |
|
Expert Programmer
Join Date: Aug 2005
Location: Rotterdam, the Netherlands
Posts: 942
Rep Power: 4
![]() |
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. |
|
|
|
|
|
#4 |
|
Professional Programmer
|
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 |
|
|
|
|
|
#5 | |
|
Professional Programmer
|
Quote:
__________________
Amateurs built the ark Professionals built the Titanic |
|
|
|
|
|
|
#6 |
|
Professional Programmer
|
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 |
|
|
|
|
|
#7 |
|
Newbie
Join Date: Apr 2005
Location: NC,USA
Posts: 17
Rep Power: 0
![]() |
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.
|
|
|
|
|
|
#8 |
|
Professional Programmer
|
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 |
|
|
|
|
|
#9 |
|
Professional Programmer
|
Download java SDK/Netbeans from Sun and the Eclipse SDK. Get this and the rest is up to you.
|
|
|
|
|
|
#10 |
|
Expert Programmer
|
Try this
public class HelloWorld
{
public static void main(String[] args)
{
System.out.println("Hello World!");
}
} |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|