如何在Eclipse for JAVA上解决此错误? [英] How can I fix this error at Eclipse for JAVA?

查看:55
本文介绍了如何在Eclipse for JAVA上解决此错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试编译并运行到JAVA代码时,Eclipse给出了错误.错误是

Eclipse give error when I try to compile and run to JAVA codes. The error is

无法启动选择,并且没有近期启动."

"The selection cannot be launched, and there are no recent launches".

如何解决此问题?

推荐答案

您的代码错误.您需要一种主要方法来启动程序

your code is wrong. you need a main method to launch your program

package main;

public class main {
    public static void main (String[] args) {
        System.out.println("Test");
    }
}

注意:类名必须始终是文件名,通常java类以大写字母开头

Note: The name of the class always has to be the name of the file, and typically java classes start with an uppercase letter

这篇关于如何在Eclipse for JAVA上解决此错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆