New to Java - Having Trouble 'Java-***' .class files
I have learned how to 'javac' Files, and I am having trouble 'javaing' them. I have tried lots of things but it says:
Exception in thread"main" java.lang.NoClassDefFoundError: HelloWorldApp
Of course I am just learning so I am trying out the HelloWorldApp just to learn how to Compile and Run my Applications.
Help please!
[377 byte] By [
Zacha] at [2007-11-26 17:49:43]

Hai Zachplz email me atravi.maxspeed@gmail.com
I suppose the obvious question is... what input produces this response?
> I suppose the obvious question is... what input> produces this response?Oh, very sorry. Forgot to put that down. After creating the .class file I tried the 'java' function and that is the output I got.
Zacha at 2007-7-9 5:02:11 >

Neverending story: http://forum.java.sun.com/thread.jspa?threadID=5134072&messageID=9485301
Zach, Zach, Zach... I think this "thread" is approaching 100 posts in total, and you still haven't been able to run your first program. Is there anyone out there who can sit down with you and show you how to do it? This really shouldn't take 100 posts!
> Neverending story:
> http://forum.java.sun.com/thread.jspa?threadID=5134072
> &messageID=9485301
>
> Zach, Zach, Zach... I think this "thread" is
> approaching 100 posts in total, and you still haven't
> been able to run your first program. Is there anyone
> out there who can sit down with you and show you how
> to do it? This really shouldn't take 100 posts!
I couldn't find my other Threads... And no, nobody in my family or anybody I know has ever been interested in programming. So, of course I need help with this.
Zacha at 2007-7-9 5:02:11 >

Still not enough info, but lacking that, check the case of the class.
helloworldapp != HelloWorldApp
also, don't include the .class extension when you run java HelloWorldApp, and make sure the file name matches the class name
Class HelloWorldApp should be saved in the file HelloWorldApp.java
~Tim
> I couldn't find my other Threads...It's a good idea to use the watchlist. In your "Forum settings" you can set it to automatically add a thread you create to your watch list, or you could check the checkbox labelled "add topic to watch list" that is below the text area.
C:\>cd C:\Documents and Settings\Owner\My Documents\java
C:\Documents and Settings\Owner\My Documents\java>PATH="C:\Program Files\Java\jdk1.6.0\bin"
C:\Documents and Settings\Owner\My Documents\java>javac HelloWorldApp.java
C:\Documents and Settings\Owner\My Documents\java>java HelloWorldApp
Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorldApp
That's what happened.
Zacha at 2007-7-9 5:02:11 >

I told you yesterday as to how you should go about doing this.
When you want to run the code do this
java -classpath . filename
(assuming that you are in the same directory where your class file is)
Don't miss the . after the classpath.After you write classpath give a space then a dot and then again a space and then your class name.Is it done now.
C:\Testing\junk>notepad HelloWorldApp.java//Create the file
//Type this in verbatim
public class HelloWorldApp {
public static void main(String [] args){
System.out.println("Hello, Cruel World!");
}
}
//save the file and exit
C:\Testing\junk>javac HelloWorldApp.java#> type this line to compile
C:\Testing\junk>java HelloWorldApp#> type this line to run
Hello, Cruel World!
Done!
Good Bye,
~Tim
Jeepers Zach! I told you you'd never get it. Didn't believe me though, did you?
>
>
> C:\Testing\junk>notepad HelloWorldApp.java
>//Create the file
> pe this in verbatim
>
> public class HelloWorldApp {
>
> public static void main(String [] args){
> System.out.println("Hello, Cruel World!");
>
> }
>
> //save the file and exit
>
>
> C:\Testing\junk>javac HelloWorldApp.java
>#> type this line to compile
> HelloWorldApp#> type this line to run
>
> Hello, Cruel World!
>
>
>
> Done!
>
> Good Bye,
>
> ~Tim
I know what to type into the Prompt, I just don't know why it isn't working.
Also, warnerja, go away if you're not going to try to help.
Zacha at 2007-7-9 5:02:11 >

I'm having this same error when I try to run my first .class file. I have set paths for my Windows XP environment variables, etc. I deleted any previous Runtime Environment versions on my computer that might interfere, now I can't even run applets on a webpage!Did you ever figure this out Zach?
> Also, warnerja, go away if you're not going to try to help. You mean my trying to get you to understand you're in the wrong field of study is not helping? Ok then, keep up the frustration and wasting of your time.
I tried the suggestion in a previous post:java -classpath . HelloWorldAppIt worked! Hurray!Now, why do I have to type that every time? And how can I get my web browser to find the new Runtime Environment I just installed?
> > C:\>cd C:\Documents and Settings\Owner\My
> Documents\java
> C:\Documents and Settings\Owner\My
> Documents\java>PATH="C:\Program
> Files\Java\jdk1.6.0\bin"
> C:\Documents and Settings\Owner\My
> Documents\java>javac HelloWorldApp.java
[b]
"after this command check,HelloWorldApp.class file is created or not..
If that calss file is not created then only this error occur"[/b]
> C:\Documents and Settings\Owner\My
> Documents\java>java HelloWorldApp
> Exception in thread "main"
> java.lang.NoClassDefFoundError: HelloWorldApp
>
>
> That's what happened.
Message was edited by:
ramesh.shriram
>same error when I try to run my first .class file
what happens when you try:
cd /d c:\
java -version
javac -version
echo %PATH%
... just post the output verbatim.
>can't even run applets on a webpage!
>deleted any previous Runtime Environment versions
that's in control panel ~ java
you removed the active JRE (aka JVM) for applets.
Message was edited by: corlettk - oops - didn't see page 2
> I tried the suggestion in a previous post:> java -classpath . HelloWorldAppDidn't I tell you to do that in one of your other posts? Try bookmarking some of your other posts and consulting those when you need help.