简体   繁体   English

使用eGit导入eclipse后,无法编译运行。 我该怎么办?

[英]After importing into eclipse using eGit, can't compile and run. What do I do?

After importing a standard.java file into Eclipse using Git, I tried to compile and run the file.使用 Git 将 standard.java 文件导入 Eclipse 后,我尝试编译并运行该文件。 Eclipse gave me this error: Eclipse 给了我这个错误:

"Unable to launch: The selection cannot be launched, and there are no recent launches."

What do I do?我该怎么办?

You must make sure your java code is in a java project.您必须确保您的 java 代码在 java 项目中。 If the git source builds from ant, there is a "File>New>Other..>Java project from ant build file".如果 git 源代码从 ant 构建,则有一个“文件>新建>其他..>来自 ant 构建文件的 Java 项目”。

Otherwise you need to create a java project in eclipse and then 1) import the source into the proj /src directory or 2) create a linked folder in eclipse that points to the source location on the file system.否则,您需要在 eclipse 中创建 java 项目,然后 1) 将源导入proj /src 目录或 2) 在 Z6B7B655DD22FAA3F10677C512493A 上指向文件的源位置的 Z6B7B655DD22FAA3F10670C512493A 目录中创建链接文件夹。

Then you need to set up the classpath (add any jars that are needed for the compile).然后您需要设置类路径(添加编译所需的任何 jars)。

In the last screen of the Eclipse "Clone Git Repository" wizard, make sure "Import all existing Eclipse projects after clone finishes" is checked.在 Eclipse“克隆 Git 存储库”向导的最后一个屏幕中,确保选中“在克隆完成后导入所有现有 Eclipse 项目。”

(Perhaps this option was not available 4 years ago when the question was posted.) (也许这个选项在 4 年前发布问题时不可用。)

Not really git-related, I don't think.我不认为与 git 相关。 You just need to tell it which file to run.您只需要告诉它要运行哪个文件。 Right click on the file with the main() function in it, and click "Run As..." > Java Application右键单击包含 main() function 的文件,然后单击“运行方式...”> Java 应用程序

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

相关问题 使用egit将项目导入eclipse - importing a project into eclipse using egit Eclipse 上的 Minecraft 1.12.2 Forge 将无法运行。 即使在我尝试了无数不同的教程和建议之后 - Minecraft 1.12.2 Forge on Eclipse won't run. Even after I've tried countless different tutorials and recommendations 如何在Android Eclipse IDE中查找/使用eGit? - How do I find/use eGit in the Android Eclipse IDE? 如何在Eclipse中使用EGit导入gradle项目? (libGDX) - How do I import gradle projects with with EGit in Eclipse? (libGDX) 我是否需要在Eclipse中编译.java文件才能运行应用程序? - Do i need to compile .java files in Eclipse to run application? Android Eclipse找不到ImageView导入我该怎么办? - Android Eclipse can't find ImageView import what do I do? 如何在Eclipse中的git分支之间进行纯文本比较(使用EGit) - How do I do a text-only compare between git branches in Eclipse (with EGit) 我该如何运行它。 我不断得到找不到符号 - How do I get this to run. I keep on getting a cannot find symbol 导入git repo后在Eclipse中的运行配置中找不到项目 - Can't find project in run configuration in Eclipse after importing git repo 我如何在 Eclipse 上从 src 文件夹编译和运行简单的 java 文件? - how do i compile and run simple java files on eclipse from a src folder?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM