Error “main class not found”

会有一股神秘感。 提交于 2019-12-02 01:18:47

You're inside the package. You should be sitting in the package root. Go one folder up.

cd ..

Then reexecute it using java project.DriverClass.


That said, you should prefer not to use the CLASSPATH environment variable. Yours is currently also invalid. There are spaces in unquoted pathnames. Also, the JDK/bin folder isn't supposed to go in the classpath. Just use the -cp argument like java -cp . project.DriverClass (while sitting in the package root folder).

Try:

C:\Program Files\Java\jdk1.6.0_21\bin>java project.DriverClass

assuming your package is project

After compiling if we get a main class not found error, It is simple try this set classpath=%classpath%;.; type this in cmd and run it..problem will be resolved

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!