helloworld编译成功,但是运行的时候出错。

hellenlong 2002-03-01 08:29:14
public class helloworld{
public static void main{
System.out.println("aaa");
}
}
javac helloworld成功
但是java helloworld失败
错误说,exception in thread "main" java.long.noclassdeffounderror:helloworld/class
各位大虾帮帮我。
...全文
128 17 打赏 收藏 转发到动态 举报
写回复
用AI写文章
17 条回复
切换为时间正序
请发表友善的回复…
发表回复
blankbox 2002-03-01
  • 打赏
  • 举报
回复
还不行吗??
cocowhb 2002-03-01
  • 打赏
  • 举报
回复
是呀,主函数不对
skyyoung 2002-03-01
  • 打赏
  • 举报
回复
http://www.csdn.net/Expert/TopicView.asp?id=85391&datebasetype=200101
peacock_king 2002-03-01
  • 打赏
  • 举报
回复
竟然能够编译通过????
main(String[] args)

java helloworld
HndyLiu 2002-03-01
  • 打赏
  • 举报
回复
哥们,我试过了,在我的机子上面。看源码:
public class helloworld{
public static void main(String args[]){
System.out.println("hello,everyone!");
}
}

路径是:c:\j2\bin
class路径也是一样的。
在那里,你运行一下:c:\j2\bin\java helloworld
就一切OK了!
huangbrid 2002-03-01
  • 打赏
  • 举报
回复
按 jackeroo(人言者)说的修改程序,
按 karma(无为) 说的设置环境变量,
运行起来应该就会没什么问题了!
HndyLiu 2002-03-01
  • 打赏
  • 举报
回复
试试看它们上面的建议吧
应该可以的
就我楼上的那两位的
gdsean 2002-03-01
  • 打赏
  • 举报
回复
exception in thread "main" java.long.noclassdeffounderror:helloworld/class
看到没有?你是这样运行的:java helloworld.class
java把你的helloworld当成包class当成类名了
所以你应该java helloworld
blankbox 2002-03-01
  • 打赏
  • 举报
回复
同意jackeroo(人言者) 的说法,
public class helloworld
{
public static void main(String[] args)
{
System.out.println("aaa");
}
}
应该没错,如果不行,那就考虑CLASS路径吧!!
  • 打赏
  • 举报
回复
在classpath环境加上 “.;”
karma 2002-03-01
  • 打赏
  • 举报
回复
add "." to your classpath in c:\autoexec.bat:
set classpath=.;%classpath%

or
add "." to your classpath environment variable

why did SUN never fix this problem? this really sucks!
waterdragonfly 2002-03-01
  • 打赏
  • 举报
回复
将当前路径(.class所在的路径)加入到CLASSPATH环境变量中
jackeroo 2002-03-01
  • 打赏
  • 举报
回复
这样应该对了吧!
public class helloworld
{
public static void main(String[] args)
{
System.out.println("aaa");
}
}
whyyy78 2002-03-01
  • 打赏
  • 举报
回复
class路径不对或classpath没设对。
这个文件有没有package?
jackeroo 2002-03-01
  • 打赏
  • 举报
回复
public class helloworld
{
public static void main(String[] args)
{
System.out.println("aaa");
}
}
jackeroo 2002-03-01
  • 打赏
  • 举报
回复
public class helloworld
{
public static void main(String[] args)
{
System.out.println("aaa");
}
}
hellenlong 2002-03-01
  • 打赏
  • 举报
回复
搞清楚了,时java helloworld就可以了

62,614

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧