0

I am getting "could not find or load main class" error even though i am setting the class path correctly.

Here is my directory structure:

 src\org\apache\ws\axis2

Inside axis2 directory, i have my Client.class file.

Now, to run the Client class file, i gave the following command from src directory

java -cp "C:\Documents and Settings\F1QBWFA\My Documents\Downloads\temp\src\org\apache\ws\axis2" org\apache\ws\axis2\Client

I tried this as well:

java -cp "C:\Documents and Settings\F1QBWFA\My Documents\Downloads\temp\src\org\apache\ws\axis2" org.apache.ws.axis2.Client

And i get the same error. What am i doing wrong here?

2 Answers 2

1

Shouldn't it be

java -cp "C:\Documents and Settings\F1QBWFA\My Documents\Downloads\temp\src" org.apache.ws.axis2.Client

Class path should refer to the root of your package structure, not to the specific folder of the inner package. Of course I'm assuming you have package org.apache.ws.axis2; at the beginning of Client.java

Sign up to request clarification or add additional context in comments.

Comments

0

As it implies, the classpath is set to a path where you can find, well, classes

I think you might be having classes stored in the bin or the classes directory.

Change your command line to:

java -cp "C:\Documents and Settings\F1QBWFA\My Documents\Downloads\temp\classes" org.apache.ws.axis2.Client

If you have the classes alongside src, then change it to

java -cp "C:\Documents and Settings\F1QBWFA\My Documents\Downloads\temp\src" org.apache.ws.axis2.Client

Classpaths should only be set till the root of the package.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.