File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Another CLASSPATH Problem!!!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Another CLASSPATH Problem!!!!" Watch "Another CLASSPATH Problem!!!!" New topic

Another CLASSPATH Problem!!!!

Abhishek Asthana
Ranch Hand

Joined: Sep 08, 2004
Posts: 146
Now this is making me mad.

I have installed java 1.5 Update 8.

My environment variables are:

I am able to compile any program from command line, but when I try to run it using java classname, I get error:
I am able to run some programs only by using java -cp option. Now the problem is that I am not able to run the programs enclosed in jar files. No matter what I am doing, I get the same error.

I have to do this:
java org.apache.axis.client.AdminClient
This compiled class is a part of axis.jar. I tried to run it in two ways.
and then extracted the files from jar file and


But the error comes:

Please help me with this!
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2398
You normally would not have the bin directory of the JDK in your CLASSPATH unless for some reason you have your source code and .class files in that directory.

The only other things you have in your CLASSPATH are jar files so the interpreter can't find your .class file because the current directory is not in the CLASSPATH.

Try removing the bin directory of the JDK from the CLASSPATH, and appending ;. to the end of the CLASSPATH.
Joanne Neal

Joined: Aug 05, 2005
Posts: 3742
If a class is in a jar file, then you have to include the jar file in the classpath. Something like
java -cp axis.jar org.apache.axis.client.AdminClient
[ August 21, 2006: Message edited by: Joanne Neal ]

I agree. Here's the link:
subject: Another CLASSPATH Problem!!!!
It's not a secret anymore!