Hi there.

I'm new to Java, but I think your problem is easy enough for me to take
a shot at. First, let me tell you what you're doing wrong, and then give
you an explanation.

Firstly, when running a Java application, do not specify the ".class"
extension. In your case, do this: java HelloWorld

Secondly, the reason for this: When running a Java application, you just
run the class file (if it happens to be in your classpath). If the
application is part of a package, and the application is not in the
classpath, but the package is, then run the application by prefixing the
package name (delimited by ".").

Here is an example: Your current directory is in your classpath, and
your application (HelloWorld) resides in the current directory, then run
it by typing "java HelloWorld". When your application is in a package
called "myPackage", run your app by typing "java myPackage.Helloworld".

When you typed "java HelloWorld.class", Java attempted to run an app
called "class" in a package called "HelloWorld".

This is the first time I attempted to help anyone on this list, please
correct me if I'm wrong. I don't want to put someone on the wrong track.

Regards,
Nobby

> -----Original Message-----
> From: Dawei [SMTP:[EMAIL PROTECTED]]
> Sent: Tuesday, May 18, 1999 6:40 AM
> To:   [EMAIL PROTECTED]
> Subject:      cannot run classfile
> 
> hello everyone:
> I had installed jdk1.2 v1 in my RH5.2 Box.
> for the test, I created  a HelloWordApp.java, I  complie it and got a
> HelloWordApp.class file.
> But when I try to run it with $:::>java HellowordApp.class
> following err message was appeared $:::>Exception in thread "main"
> java.lang.NoClassDefFoundError: HelloWorldApp/class
> can everyboby tell me WHY?
> 


----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to