码迷,mamicode.com
首页 > 其他好文 > 详细

HelloWorld

时间:2016-05-15 16:48:05      阅读:180      评论:0      收藏:0      [点我收藏+]

标签:

借读《Java核心技术-卷I》的机会,对Java知识体系进行梳理,写博进行记录。

Eclipse:https://eclipse.org/downloads/ 

JDK:http://www.oracle.com/technetwork/java/javase/downloads/index.html

注意eclipse-inst需要用管理员模式运行,否则安装文件无法正常下载。

参考:http://stackoverflow.com/questions/32637399/error-installing-eclipse-ide-on-windows

编写一段代码进行调试

1 public class HelloWorld
2 {
3     public void main()
4     {
5         System.out.println("Hello World");
6     }
7 }

编译报错"Registry key Error: Java version has value ‘1.8‘, but ‘1.7‘ is required"

delete java.exe, javaw.exe and javaws.exe  from Windows\System32 问题解决

参考:http://stackoverflow.com/questions/29697543/registry-key-error-java-version-has-value-1-8-but-1-7-is-required

        http://stackoverflow.com/questions/26324486/properly-installing-java-8-along-with-java-7

之后编译报错"错误: 在类 HelloWorld 中找不到主方法, 请将主方法定义为:public static void main(String[] args)"

代码修改为

1 public class HelloWorld
2 {
3     public static void main(String[] args)
4     {
5         System.out.println("Hello World");
6     }
7 }

问题解决

存疑:为什么main一定要写成 public static void main(String[] args) 

HelloWorld

标签:

原文地址:http://www.cnblogs.com/issacpan/p/5495240.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!