The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
November 2000



This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.


Ask for help

Posted by Lu Ping on November 27, 2000 at 3:18 AM

> I know your problem. You are putting your class in a package like
> package ;

> class Test {

> }

> In this case your program will compile fine if you give a command
> javac
> However, it won't run when you give a command
> java Test
> You have to give a command
> java
> I mean you have to give a fully-qualified name of your class Test. And make sure that you have set the classpath correctly. If you have a directory strucure like
> C:\lu\ping\
> then you must include C:\ in your classpath variable in autoexec.bat if you are using windows95/98.

> Thanx
> Kishori

Thanks for your reply.As for the problem, I found another phenomenon.
I work in Win2000 Professional,Jbuilder4. the compile and run is under the cmd shell using jdk1.3 in Jbuilder4.
I add the classpath in the system environment variables of win2000, and this problem comes,include the examples of chapter2,3,4 which didn't use package. I tried to delete the variable, and then found it can work again for the examples before chapter 4.As for the examples about using package,it can't compile.
I think whether the problem comes from the classpath setting?
when no the variable, is a system classpath for jdk existing?
should I append my own path on it? and how?


Sponsored Links

Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us