How to resolve this error Caused by: java.lang.ClassNotFoundException

允我心安 提交于 2019-12-02 02:17:49

Try running

java -cp ABSOLUTE_PATH com.abc.project.helloworld

Where ABSOLUTE_PATH refers to the directory where the class files along with packages are present. say it is bin directory where the class files are generated along with same directory structure as source files

First Please name Class with Capital Letter like HelloWorld.java

If you are in a folder '/myjava' in cmd and your .java files is in this folder then do this in cmd

D:\\myjava\:> javac -d HelloWorld.java

This will create correct package Structure for you Then don't go anywhere from the same location do this

D:\\myjava\:>  java com.abc.project.HelloWorld

It should work fine!!

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