如何导入java项目(Eclipse)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4488247/
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 15:31:03  来源:igfitidea点击:

How to import java project (Eclipse)

javaeclipsebuild

提问by tom

I have tried importing a .zip project through eclipse by right clicking the project and selecting import, then navigating to the zip folder on my desktop and there we go. If i do this, i get a red exclamation mark next to the project name, which after googling i found was because of an error with the build path.

我已经尝试通过 Eclipse 导入一个 .zip 项目,方法是右键单击项目并选择导入,然后导航到桌面上的 zip 文件夹,然后就可以了。如果我这样做,我会在项目名称旁边看到一个红色感叹号,在谷歌搜索后我发现这是因为构建路径错误。

The .zip was created from my bosses machine and emailed to me, however he is not in the office today and i am only a placement student so i have pretty much no idea how to fix this.

.zip 是从我的老板机器创建并通过电子邮件发送给我的,但是他今天不在办公室,我只是一个实习生,所以我几乎不知道如何解决这个问题。

Does anyone have any tips/ help they can provide me. Thanks

有没有人可以为我提供任何提示/帮助。谢谢

回答by Andreas Dolk

The import was correct. Fixing build path errors is a common task after importing projects.

导入是正确的。修复构建路径错误是导入项目后的一项常见任务。

You'll have to look at the build path settings for this project and have to find out, which libraries are missing and dependencies are unresolved.

您必须查看此项目的构建路径设置,并且必须找出缺少哪些库以及未解决的依赖项。

Right-click on the project name, --> Build Path --> Configure Build Path...

右键单击项目名称,--> 构建路径--> 配置构建路径...

Check Projectsand LibrariesTab, the reason for the red exclamation mark is in there.

检查项目选项卡,红色感叹号的原因在那里。



You have to get rid of the build path errors, otherwise eclipse can't buildthe project. Either provide valid paths for all libraries or delete classpath entries.

您必须摆脱构建路径错误,否则eclipse无法构建项目。为所有库提供有效路径或删除类路径条目。

The should remove that exclamation mark and eclipse can build the project. But removing classpath entries most likely results in compile errors or runtime errors, if the application can't find external configuration files or so.

应该去掉那个感叹号,eclipse就可以构建项目了。但是,如果应用程序找不到外部配置文件等,那么删除类路径条目很可能会导致编译错误或运行时错误。

In your special case: Looks like the project depends on other projects (we see that quite often in eclipse) and it could be, that your boss did not give you all projects or your eclipse is not setup correctly (maybe your workspace shouldcontain some default projects with default libraries). Ask co-workers, they may give a hint on that.

在您的特殊情况下:看起来该项目依赖于其他项目(我们在 eclipse 中经常看到这种情况)并且可能是您的老板没有给您所有项目或您的 eclipse 设置不正确(也许您的工作区应该包含一些带有默认库的默认项目)。问同事,他们可能会给出提示。

回答by darioo

Right click on your project, then select "build path", then "configure build path". There will probably be errors in "libraries" tab. Examine them and try to fix them. For example, your boss might have a different JRE (Java Runtime Environment) path than you do.

右键单击您的项目,然后选择“构建路径”,然后选择“配置构建路径”。“库”选项卡中可能会出现错误。检查它们并尝试修复它们。例如,您的老板可能拥有与您不同的 JRE(Java 运行时环境)路径。

回答by shikari

Go to 'configure build path' > android > select a target which will be available there. if this doesn't work then copy the 'lib' folder of any other project and paste it in your project. this will work together with target selected.

转到“配置构建路径”> android > 选择一个可用的目标。如果这不起作用,则复制任何其他项目的“lib”文件夹并将其粘贴到您的项目中。这将与选定的目标一起工作。