> Exception in thread "main" java.lang.NoClassDefFoundError: HelloApp/Class
Papastefanos Serafeim wrote:
> Try running it using
> java HelloApp
>
> (instead of java.HelloApp.class)
> Thats how i ran it and it comes up with that error, any idea?
You are contradicting yourself. If that's really how you ran it, then
the error message you posted earlier is not the error message you
received. Post the real error message, or check the command line
again.
/gordon

Signature
[ don't email me support questions or followups ]
g o r d o n + n e w s @ b a l d e r 1 3 . s e
Glenn Coyle - 24 Oct 2006 12:32 GMT
>>Exception in thread "main" java.lang.NoClassDefFoundError: HelloApp/Class
>
[quoted text clipped - 13 lines]
>
> /gordon
hi gordon
sorry take the /class off the error line
i ran it two ways
java HelloApp
and
java HelloApp.class
the only difference that i got in the error message was the /class
sorry does this make more sense?
I cant post a screen shot here can i to show what i am doing?
Mishagam - 24 Oct 2006 13:03 GMT
>>> Exception in thread "main" java.lang.NoClassDefFoundError:
>>> HelloApp/Class
[quoted text clipped - 3 lines]
>>> Try running it using
>>> java HelloApp
> sorry take the /class off the error line
>
[quoted text clipped - 11 lines]
>
> I cant post a screen shot here can i to show what i am doing?
May be you forgot to run java compiler?
javac HelloApp.java
Philip Reimer - 24 Oct 2006 13:08 GMT
Glenn Coyle schrieb:
>>> Exception in thread "main" java.lang.NoClassDefFoundError:
>>> HelloApp/Class
[quoted text clipped - 32 lines]
>
> I cant post a screen shot here can i to show what i am doing?
try "java -cp . HelloApp" in the directory containing HelloApp.class
Gordon Beaton - 24 Oct 2006 13:09 GMT
> i ran it two ways
>
[quoted text clipped - 5 lines]
>
> the only difference that i got in the error message was the /class
In that case try:
java -cp . HelloApp
/gordon

Signature
[ don't email me support questions or followups ]
g o r d o n + n e w s @ b a l d e r 1 3 . s e
Glenn Coyle - 24 Oct 2006 13:21 GMT
>>i ran it two ways
>>
[quoted text clipped - 11 lines]
>
> /gordon
winner
gold mate that works, can you let me know why it works this way and not
the other
sorry to be a pain
Gordon Beaton - 24 Oct 2006 13:25 GMT
> gold mate that works, can you let me know why it works this way and
> not the other
The argument to "java" isn't a filename, it's a classname. Java
searches the classpath for the class, and "-cp ." adds the current
directory to the classpath. You could also set CLASSPATH=. in your
environment.
/gordon

Signature
[ don't email me support questions or followups ]
g o r d o n + n e w s @ b a l d e r 1 3 . s e
Tom Forsmo - 24 Oct 2006 14:35 GMT
>> gold mate that works, can you let me know why it works this way and
>> not the other
[quoted text clipped - 3 lines]
> directory to the classpath. You could also set CLASSPATH=. in your
> environment.
This means that for all code you write or use, java searches all the
paths in classpath to find the classes it is looking.
A CLASSPATH or -cp can look like this:
CLASSPATH=.:/my/project/lib:/my/project/module1
In all these paths you can store any classfiles or jar files (Java class
ARchives) you need. This is basically a way to organise your code into
modules and allow access to external libraries.
tom
Jeff - 24 Oct 2006 16:53 GMT
> >> gold mate that works, can you let me know why it works this way and
> >> not the other
[quoted text clipped - 15 lines]
>
> tom
And don't forget that the package name acts as a sort of folder or
directory as well...