线程"main"中的异常java.lang.NoClassDefFoundError :(名称错误 [英] Exception in thread "main" java.lang.NoClassDefFoundError: (wrong name

查看:519
本文介绍了线程"main"中的异常java.lang.NoClassDefFoundError :(名称错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的项目在"\ BankPrj"文件夹中 它有

my project is in "\BankPrj" folder It has

(1).com文件夹

(2)Account.javaCustomer.javaTestBanking.java文件

(3)主类在TestBanking.java

这是错误.

这是我完整的项目

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

请更正错误.

我从测试文件夹本身执行了TestBanking.class.

i executed TestBanking.class from test folder itself.

推荐答案

您的程序包是com.mybank.test

Your package is com.mybank.test

您应该调用的方法是转到Folder BankPrj.

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

现在做 java -classpath. com.mybank.test.TestBanking

现在应该可以使用.

请记住,您不能进入文件夹的叶子来执行您的课程.您应该始终停留在根目录下(使用软件包时),并以完全合格的软件包名称和类名称执行以执行该软件包.

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.

希望这会有所帮助!

这篇关于线程"main"中的异常java.lang.NoClassDefFoundError :(名称错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆