本帖最后由 无奈的年华ˊ 于 2014-2-13 23:07 编辑
程序:↓
class Test
{
public static void main(String[] args)
{
getStr();
}
public static void getStr()
{
//定义一个字符串
String name = "itheima";
System.out.print(name);
}
}
报错:↓
Exception in thread "main" java.lang.NoClassDefFoundError: test (wrong name: Tes
t)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:14
2)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)
为什么编译的时候没问题,运行就报错呢?
|