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

前端 未结 11 1842
难免孤独
难免孤独 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 01:57

    1. Right-click in the package explorer and select New - Java Project
    2. Create the new project Game
    3. Open the new project in the package explorer - you should see only the source folder called src (there's nothing inside yet)
    4. Open a file Explorer (e.g. Windows Explorer) and drag your sources
    5. Drag them to Eclipse and drop them inside the new src folder - if asked select "Copy files"
    6. Eclipse should put the files into the default package, if that's not correct you can edit the offending files (marked with a red cross) by opening them in Eclipse, selecting the package declaration (usually line 1), pressing Ctrl + 1 and selecting the appropriate option (e.g. "Move xy to package com.game"

提交回复
热议问题