如何在 Eclipse 中运行项目?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5737455/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 16:12:40  来源:igfitidea点击:

How do I run a project in Eclipse?

javaeclipse

提问by Mike

Working on a project in Eclipse 3.6, I used the subeclipse subversion stuff to download my file and now whenever I try to run it I get the following error:

在 Eclipse 3.6 中处理一个项目,我使用 subeclipse subversion 来下载我的文件,现在每当我尝试运行它时,我都会收到以下错误:

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

选择无法启动,最近没有启动

Any ideas guys?

有什么想法吗?

采纳答案by p27

If you have a downloaded project, first you have to import it:

如果你有一个下载的项目,首先你必须导入它:

  1. Go to project explorer
  2. Right click
  3. Select import
  4. If it is a war file choose as it or import as file system. There are many choices there. After that you have to add REQUIRED JARon its class path, or if its a web projectyou have to add REQUIRED JARin WEB_INF/lib folder.
  1. 转到项目浏览器
  2. 右键点击
  3. 选择导入
  4. 如果是war文件,选择 as it 或 import as file system。那里有很多选择。之后,你必须添加所需的JAR其对类路径,或者如果它是一个Web项目必须添加所需的JARWEB_INF/lib folder

回答by mikera

Depends a bit on what kind of project this is..... Eclipse supports different kinds of launchers for different kinds of projects.

取决于这是什么类型的项目..... Eclipse 支持不同类型的项目的不同类型的启动器。

But assuming it's a relatively standard Java project, just right click on the main class and do "Run As... / Java Application".

但是假设它是一个相对标准的Java项目,只需右键单击主类并执行“Run As... / Java Application”。

This should launch your application, and Eclipse will remember this configuration the next time you try to run.

这应该会启动您的应用程序,Eclipse 将在您下次尝试运行时记住此配置。