无法在 Eclipse 中打开现有项目

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

Can't Open Existing Project in Eclipse

eclipse

提问by

I'm trying to open an existing Android project in Eclipse. I've gone to File > Import > General > Existing Project (or something like that). I've chosen the file project folder. But every time I try to open the folder, all I get is an error.

我正在尝试在 Eclipse 中打开一个现有的 Android 项目。我已经转到文件 > 导入 > 常规 > 现有项目(或类似的东西)。我选择了文件项目文件夹。但是每次我尝试打开文件夹时,我得到的只是一个错误。

  • Some projects cannot be imported because they already exist in the workspace*
  • 某些项目无法导入,因为它们已存在于工作区中*

Is there any other way of opening my project?

有没有其他方法可以打开我的项目?

回答by VonC

You cannot import a project with a name already present in your current Eclipse workspace.

您不能导入名称已存在于当前 Eclipse 工作区中的项目。

The surest way to work around that is to switch workspace(menu File / Switch workspace), and create a new workspace (in which you will be able to import that project).

解决这个问题的最可靠方法是切换工作区(菜单文件/切换工作区),并创建一个新的工作区(您将能够在其中导入该项目)。

switch workspace

切换工作区

A more complex solution would be to try and rename an existing project in your current workspace.

更复杂的解决方案是尝试重命名当前工作区中的现有项目

Check other causes in:

检查其他原因:

回答by Raja Anbazhagan

I faced the same issue, But it is as designed. When people close the project, It simply makes the project unavailable in the eclipse project view. This is why people thinks that it has been completely removed from the view.

我遇到了同样的问题,但它是按设计的。当人们关闭项目时,它只会使项目在 eclipse 项目视图中不可用。这就是为什么人们认为它已完全从视图中删除的原因。

So All you have to do is to go to

所以你所要做的就是去

Window -> Show view -> Project Explorer

窗口 -> 显示视图 -> 项目资源管理器

Now you will see your project in the Project Explorer sidebar with a different closed folder Icon as shown in this image.

现在,您将在 Project Explorer 侧栏中看到您的项目,其中包含一个不同的关闭文件夹图标,如图所示。

This is how a closed project would look in your workspace when you see from project explorer.

当您从项目资源管理器中看到时,这就是关闭的项目在您的工作区中的外观。

Once you right click and open project you will see the magic you are looking for.

右键单击并打开项目后,您将看到您正在寻找的魔法。

回答by Sabina Talibova

I had the same problem and I solved it finally. So, lets say you want to open "TEST" project on eclipse. And you project is in this path: C:\Users\Sabina Comp\Desktopthen your workspace should be C:\Users\Sabina Comp\Desktopnot C:\Users\Sabina Comp\Desktop\TEST. You can switch workspace by going to File->Switch workspace->other I hope it will help you!

我有同样的问题,我终于解决了。因此,假设您想在 Eclipse 上打开“TEST”项目。并且您的项目位于此路径中:C:\Users\Sabina Comp\Desktop那么您的工作区应该 C:\Users\Sabina Comp\Desktop不是C:\Users\Sabina Comp\Desktop\TEST. 您可以通过转到文件->切换工作空间->其他来切换工作空间,希望对您有所帮助!

回答by user234159

I faced the same problem. Maybe the cause of your problem is as simple as mine.

我遇到了同样的问题。也许你的问题的原因和我的一样简单。

I closed (not delete) my project in the Java Browsing view. Unlike the Java view, the project becomes invisible in the Java Browsing view. So I thought I deleted the project. But turns out my project is still in use when I try to import it.

我在 Java 浏览视图中关闭(而不是删除)我的项目。与 Java 视图不同,该项目在 Java 浏览视图中变得不可见。所以我以为我删除了该项目。但是当我尝试导入它时,我的项目仍在使用中。

So I went to Java Browsing view and right click the blank space in the Projects panel, click Open Project and the project is back!

所以我转到 Java 浏览视图并右键单击“项目”面板中的空白区域,单击“打开项目”,项目又回来了!

回答by sunny shekhar

Right click on a working set --> properties. You should be able to see all the projects that are available in your workspace. Select it. Next all the projects should be listed in your working set.

右键单击工作集 --> 属性。您应该能够看到工作区中可用的所有项目。选择它。接下来,所有项目都应列在您的工作集中。

回答by Ram S

Here's what worked for me:

以下是对我有用的内容:

Right click on the project > Source > Format

右键单击项目>源>格式

回答by nav3916872

I guess you want to create a copy of the existing project and make changes to the new one. Or you have got a project whose name matches the name of the existing project and you want to import the new project as well.

我猜您想创建现有项目的副本并对新项目进行更改。或者您有一个名称与现有项目名称匹配的项目,并且您也想导入新项目。

In the first case , you just need to simply copy(Ctrl+C) and paste(Ctrl+P) in the package or project explorer in the eclipse and it will ask you for a new project name -- rather than copying the project folder in the windows explorer and renaming the project folder name.

在第一种情况下,您只需要在 eclipse 中的包或项目资源管理器中简单地复制(Ctrl+C)和粘贴(Ctrl+P),它就会要求您提供一个新的项目名称——而不是复制项目文件夹在 Windows 资源管理器中并重命名项目文件夹名称。

If you have copied the project in windows explorer and tried importing the project in eclipse you will get the above error Or if u have got a project whose name matches the name of the existing project in eclipse also you will get the above error. Solution for both -- is to delete the .project , .classpath and .settings files and import the project. It will successfully import if u have changed the folder name.

如果您在 Windows 资源管理器中复制了该项目并尝试在 eclipse 中导入该项目,您将收到上述错误或者如果您有一个名称与 eclipse 中现有项目名称匹配的项目,您也会收到上述错误。两者的解决方案是删除 .project 、 .classpath 和 .settings 文件并导入项目。如果您更改了文件夹名称,它将成功导入。

Tip: If its a maven project , you can import it as a Java Project and then RightClick on the project and Configure->Convert To maven project.

提示:如果是 maven 项目,可以将其导入为 Java 项目,然后右键单击该项目并配置->转换为 maven 项目。

回答by Ninad Pingale

In my case, problem was - I deleted the code directory from its location. And at the same time I closed Eclipse. So when I reopened Eclipse, it searched for project and couldnt get it.

就我而言,问题是 - 我从其位置删除了代码目录。同时我关闭了 Eclipse。所以当我重新打开 Eclipse 时,它​​搜索项目并无法获得它。

I restored the code directory at original place. Opened Eclipse. When tried to import project again I found it in closedcondition.

我在原始位置恢复了代码目录。打开 Eclipse。当尝试再次导入项目时,我发现它处于良好closed状态。

I opened it and it started working properly.

我打开它,它开始正常工作。

回答by Aakash paliwal

Just delete the .project file and try to open the project again in Eclipse File Explorer :)

只需删除 .project 文件并尝试在 Eclipse 文件资源管理器中再次打开该项目:)