简体   繁体   English

将.java文件添加到Eclipse中?

[英]Adding .java files into eclipse?

I am so new to this, this is probably a stupid question but... 我对此很陌生,这可能是一个愚蠢的问题,但是...

Basically my lecturer has given us a bunch a of .java demos. 基本上,我的讲师给了我们很多.java演示。 They are all inside a single file called 'demos'. 它们都在一个名为“ demos”的文件中。 I was wondering how would I import the 'demos' folder into Eclipse so I can use the folder expand it and select and drag any program I want to run into the work space. 我想知道如何将'demos'文件夹导入Eclipse,以便可以使用该文件夹将其展开并选择并将要运行的任何程序拖放到工作区中。

Right click in project, Import... > General > Existing Projects into Workspace, chose your project. 右键单击项目,依次单击导入...>常规>现有项目到工作区,然后选择您的项目。

Or: 要么:

Create a new project, drag and drop example.java files. 创建一个新项目,拖放example.java文件。

Extract your demos folder somewhere. 将您的演示文件夹解压缩到某处。 Right click on the project browser, then: 右键单击项目浏览器,然后:

  1. New -> Java Project 新增-> Java项目
  2. Enter a project name then press Next 输入项目名称,然后按下一步
  3. Click "Link additional source folder" in the bottom half of this page 点击此页面下半部分的“链接其他源文件夹”
  4. Select your source folder 选择您的源文件夹
  5. Finish

Now your folder will appear in your project, and you can edit files as usual. 现在,您的文件夹将出现在您的项目中,并且您可以照常编辑文件。 Keep in mind that editing / adding / removing files there will modify the actual files in that source folder. 请记住,在那里编辑/添加/删除文件将修改该源文件夹中的实际文件。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM