如何将现有目录导入Eclipse? [英] How to import an existing directory into Eclipse?

查看:147
本文介绍了如何将现有目录导入Eclipse?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是Mac,但我认为这不会有所作为。我有一个目录,我想将其完全导入/添加到Eclipse中。我所做的是:

I am on a mac, but I don't think it will make a difference. I have a directory that I want to fully import/add into Eclipse. What I did is this:


  1. 右键单击导入

  2. 常规→现有项目进入工作区

  1. Right click import
  2. General → Existing Projects into Workspace

然后,当我单击浏览以查找根目录或存档文件并选择我可以的文件夹时,单击完成。该文件夹为空,仅包含几个文件夹,但是由于某些原因,我无法单击完成。

Then when I click browse for either root directory or archive file and select the folder I can't click finish. The folder is empty and just contains a few folders but for some reason I can't click finish.

推荐答案

Eclipse UI是有点混乱。

The Eclipse UI is a little bit confusing.

导入->将现有项目导入工作区实际上意味着导入现有 Eclipse 项目进入工作区。这就是为什么您不能单击完成的原因:导入选项在您拥有的目录中查找 .project 文件(Eclipse用于存储项目选项的文件)

The Import -> "Existing projects into workspace" actually means import "Existing Eclipse projects into workspace". That's why you can't click on finish: the import option looks for a .project file (the file used by Eclipse to store the project options) in the directory that you have chosen.

要导入没有Eclipse项目文件的现有源代码,可以使用以下选项(我想您要创建一个Java项目): / p>

To import existing source code that doesn't have an Eclipse project file you have the following options (I suppose that you want to create a Java project):


  1. 工作区目录中的新项目:在工作区中创建一个新的空Java项目(文件- > New-> Java Project)。然后右键单击源文件夹,然后选择导入...->常规->文件系统,然后选择您的文件,它将对您的文件进行复制

  1. New project inside the workspace dir: Create a new empty Java project into the workspace (File->New->Java Project). Then right click on the source folder and choose Import...->General->File system then choose your files, and it will make a copy of your files.

提示::您可以将文件从Finder拖放到src文件夹中。

Tip: you can drag&drop your files from the Finder into the src folder.

在现有目录中创建一个eclipse项目:创建一个新的Java项目,但在 New Java Project窗口中:

Create an eclipse project in your existing dir: Create a new Java project, but in the "New Java Project" window:


  • 取消选中使用默认位置选项,然后选择非Eclipse项目所在的目录。

  • 单击下一步并配置源文件所在的非Eclipse项目的子目录。您已经完成了:)

  • Un check the Use default location option, and choose the directory where is your non-Eclipse project.
  • Click Next and configure the sub-directories of your non-Eclipse project where the source files are located. And you are done :)

这篇关于如何将现有目录导入Eclipse?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆