Exception in thread “main” java.lang.NoClassDefFoundError: (wrong name [closed]

拜拜、爱过 提交于 2019-12-11 01:23:58

问题


my project is in "\BankPrj" folder It has

(1).com folder

(2)Account.java,Customer.java,TestBanking.java files

(3) main class is in TestBanking.java

this is the error..

this is my complete project

https://docs.google.com/folder/d/0BzMe2Ya7vhrAem5rcEljc3k1cFE/edit

pls correct the errors.

i executed TestBanking.class from test folder itself.


回答1:


Your package is com.mybank.test

The way you should invoke is that go to Folder BankPrj.

now do java -classpath . com.mybank.test.TestBanking

This should work now.

Remember, you cannot go into the leaf of the folder to execute your class. You should always stay at the root (when using the package) and execute with fully qualified package name and the class name to execute it.

Hope this helps!



来源:https://stackoverflow.com/questions/13994613/exception-in-thread-main-java-lang-noclassdeffounderror-wrong-name

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