eclipse 如何将java源代码导入eclipse?

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

how to import java source into eclipse?

eclipse

提问by javapowered

Sorry for probably too novice question

对不起,可能太新手的问题

I have folder on file system that contains java sources, like that: C:\project\src\com\sun\blahblah...\Main.java

我在文件系统上有包含 java 源的文件夹,例如:C:\project\src\com\sun\blahblah...\Main.java

Main class is in the package com.sun.blahblah... and contain public static void main method, i.e. everything is well-formed :)

主类在包 com.sun.blahblah... 中,包含 public static void main 方法,即一切都格式良好:)

I want to import entire folder C:\project\src then I want to right-click Main.java and run it as Java application.

我想导入整个文件夹 C:\project\src 然后我想右键单击 Main.java 并将其作为 Java 应用程序运行。

What kind of import should I select in Eclipse (from file-system or what)?

我应该在 Eclipse 中选择什么样的导入(从文件系统或什么)?

Note I don't want to create copy of my sources. They are under SVN already. I want to edit/run existent soures.

注意我不想创建我的源的副本。他们已经在 SVN 下。我想编辑/运行现有的资源。

回答by Abdullah Jibaly

  1. Create a new Java project in Eclipse
  2. Select c:\project as the root folder of the project (create a project from existing source)
  1. 在 Eclipse 中创建一个新的 Java 项目
  2. 选择 c:\project 作为项目的根文件夹(从现有源创建一个项目)

回答by rlopez

Create a new project in your Eclipse workspace (or use an existing project)

在 Eclipse 工作区中创建一个新项目(或使用现有项目)

Rigth-click on the project

右键单击项目

Select “Import…” / “General” / “File System

选择“导入...”/“常规”/“文件系统

Choose the directory, select the filesand IMPORT

选择目录,选择文件导入