在eclipse中运行helloworld报错!!

软件和网站开发以及相关技术探讨
回复
askme
帖子: 45
注册时间: 2007-07-08 15:24

在eclipse中运行helloworld报错!!

#1

帖子 askme » 2008-11-07 23:21

我的代码:
public class hello
{
public static void main(String[] args)
{
System.out.println("hello\r\n");
}
}

报错:
Editor does not contain a main type.

请问这是什么原因?
os340223
帖子: 38
注册时间: 2008-10-15 17:20

Re: 在eclipse中运行helloworld报错!!

#2

帖子 os340223 » 2008-11-10 22:58

在你的代码中,看不到错误。
fjfhlqjtg
帖子: 13
注册时间: 2008-11-07 23:56

Re: 在eclipse中运行helloworld报错!!

#3

帖子 fjfhlqjtg » 2008-11-10 23:36

你的jdk环境变量没有设置好
fjfhlqjtg
帖子: 13
注册时间: 2008-11-07 23:56

Re: 在eclipse中运行helloworld报错!!

#4

帖子 fjfhlqjtg » 2008-11-10 23:37

在win里面遇到过
xin1092134
帖子: 20
注册时间: 2008-11-08 21:28

Re: 在eclipse中运行helloworld报错!!

#5

帖子 xin1092134 » 2008-11-15 0:22

命名规范..
类首字母大写.

这报的错是你把main当一个类型使用了,系统找不到

学学英语,谢谢.
写程序前先知道命名规范.否则别人很难读懂.
dbzllx
帖子: 29
注册时间: 2008-10-18 23:44

Re: 在eclipse中运行helloworld报错!!

#6

帖子 dbzllx » 2008-11-22 17:01

main 其实还是用C风格去写好一些,放在类里感觉有点不伦不类
臧大海
帖子: 2
注册时间: 2008-12-03 16:22

Re: 在eclipse中运行helloworld报错!!

#7

帖子 臧大海 » 2008-12-03 16:25

dbzllx 写了:main 其实还是用C风格去写好一些,放在类里感觉有点不伦不类
放在类里的好处是一个项目可以有多个main
回复