62,612
社区成员
发帖
与我相关
我的任务
分享
//hello.java
public class Hello
{
public static void main(String[] args)
{
System.out.println("hello world");
}
}
//编译运行
C:\Documents and Settings\Administrator\桌面>javac hello.java
C:\Documents and Settings\Administrator\桌面>java hello
/*这样没问题
但是我把hello.java文件里面加了 package my;以后,重新编译
C:\Documents and Settings\Administrator\桌面>javac hello.java
C:\Documents and Settings\Administrator\桌面>java my.hello
这时候提示错误:Exception in thread "main" java.lang.NoClassDefFoundError:my/Hello
在下乃JAVA一小菜鸟。对这问题不甚明了,望各位高手大哥大姐赐教一二,不胜感激涕零。谢谢
*/
C:\Documents and Settings\Administrator\桌面>javac hello.java
C:\Documents and Settings\Administrator\桌面>java my.hello