How to create a project from existing source in Eclipse and then find it?

前端 未结 11 1820
难免孤独
难免孤独 2020-11-28 01:50

I have created several .java files. All of them are located in one directory. I used a text editor to write these files. Now I want to switch to Eclipse. How can I do it? I

相关标签:
11条回答
  • 2020-11-28 02:12

    There are two things

    1- If its already a Eclipse Project, then simply go to File->Import->General->Existing Project into Workplace

    2- Otherwise define project type e.g. Java, Web etc Create a new project of type you define into your workplace. Copy Paste source , lib and other necessary files. refresh, compile and run project in eclipse.

    0 讨论(0)
  • 2020-11-28 02:12
    1. Create a new project..
    2. Right Click on your project..
    3. Select Build path --> Configure Build Path
    4. Under source tab choose link source, your .java files containing folder..

    I am suggesting this since none of the methods that you tried have worked ---FYI

    0 讨论(0)
  • 2020-11-28 02:16

    While creating a project from a full folder may or may not work within the workspace, there's a condition outside of the workspace that prevents starting a new project with a full folder.

    This is relevant if you use numerous folder locations for sources, for example an htdocs or www folder for web projects, and a different location for desktop Java applications.

    The condition mentioned occurs when Eclipse is told to create a new project, and given a full folder outside the workspace. Eclipse will say the folder isn't empty, and prevent creating a new project within the given folder. I haven't found a way around this, and any solution requires extra steps.

    My favorite solution is as follows

    1. Rename the full folder with an appended "Original" or "Backup.
    2. Create the Eclipse project with the name of the full folder before the folder was renamed.
    3. Copy all the relabeled full folders contents into the new project folder.

    Eclipse should make a new project, and update that project with the new folder contents as it scans for changes. The existing sources are now part of the new project.

    Although you had to perform three extra steps, you now have a backup with the original sources available, and are also able to use a copy of them in an existing project. If storage space is a concern, simply move/cut the source rather than fully copy the original folder contents.

    0 讨论(0)
  • 2020-11-28 02:18

    This answer is going to be for the question

    How to create a new eclipse project and add a folder or a new package into the project, or how to build a new project for existing java files.

    1. Create a new project from the menu File->New-> Java Project
    2. If you are going to add a new pakcage, then create the same package name here by File->New-> Package
    3. Click the name of the package in project navigator, and right click, and import... Import->General->File system (choose your file or package)

    this worked for me I hope it helps others. Thank you.

    0 讨论(0)
  • 2020-11-28 02:22

    Follow this instructions from standard eclipse docs.

    1. From the main menu bar, select command link File > Import.... The Import wizard opens.
    2. Select General > Existing Project into Workspace and click Next.
    3. Choose either Select root directory or Select archive file and click the associated Browse to locate the directory or file containing the projects.
    4. Under Projects select the project or projects which you would like to import.
    5. Click Finish to start the import.
    0 讨论(0)
提交回复
热议问题