2

I am reading a excel file using java and i am executing the program with the below command but its giving me error: Could not find or load main class Test

My main class is in the same directory where i am running the program D:\java\Test>java -classpath "D:\java\Test\poi-3.9-20121203.jar;D:\java\Test\poi-ooxml-3.9-20121203.jar Test

Spent whole day to find out why this error is coming please help me out.

1 Answer 1

1

Basically, there are two main causes:

The first likely cause is that you may have provided the wrong class name. (Or ... the right class name, but in the wrong form.)

The second likely cause is that the class name is correct, but that the java command cannot find the class. To understand this, you need to understand the concept of the "classpath". This is explained well by the Oracle documentation:

http://docs.oracle.com/javase/7/docs/technotes/tools/windows/java.html

Setting classpath:

http://docs.oracle.com/javase/7/docs/technotes/tools/windows/classpath.html

The Java Tutorial - http://docs.oracle.com/javase/tutorial/essential/environment/paths.html

For more detail check this link What does "Could not find or load main class" mean?

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.