简体   繁体   English

如何在Eclipse for JAVA上解决此错误?

[英]How can I fix this error at Eclipse for JAVA?

Eclipse give error when I try to compile and run to JAVA codes. 当我尝试编译并运行到JAVA代码时,Eclipse给出了错误。 The error is 错误是

"The selection cannot be launched, and there are no recent launches". “无法启动选择,并且没有近期启动”。

How to fix this issue ?? 如何解决这个问题? 错误在这里...

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");
    }
}

Note: The name of the class always has to be the name of the file, and typically java classes start with an uppercase letter 注意:类的名称必须始终是文件名,通常,java类以大写字母开头

I think you should run main first and describe your problem in more detail if you still have a problem. 我认为您应该首先运行main,如果仍然有问题,请更详细地描述问题。

Q: When I try to run my project by clicking the green "Play" button, I get an error of, "The Selection cannot be launched, and there are no recent launches." 问:当我尝试通过单击绿色的“播放”按钮来运行项目时,出现错误消息:“选择无法启动,并且最近没有启动。”

A: See previous question. 答:请参阅上一个问题。 You must run your project's "Main" class at least once by using the right-click method described above, before the "Play button" to run a project will work. 在运行“播放按钮”才能运行项目之前,必须使用上述右键单击方法至少运行一次项目的“ Main”类。

http://courses.cs.washington.edu/courses/cse143/15wi/eclipse_tutorial/faq.shtml http://courses.cs.washington.edu/courses/cse143/15wi/eclipse_tutorial/faq.shtml

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM