|How to create a project from existing source in Eclipse and then find it? [message #1821391]
|Wed, 12 February 2020 11:15
| rohit bhat
Registered: February 2020
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 have tried many ways. None of them works.
I think the common way is to have a source in the eclipse folder called "workspace" which was told by my friend who did the Java training course. So, how do I get my files in these directories? Should I use eclipse to create a new project from existing source and Eclipse will put all file to the workspace? Or I should manually copy all my files to the workspace? Where should I put my class files then? Should I create a subdirectory? With which name?
When I try to create a project with the name "game", the eclipse writes to me that a project with such a name already exists. But how can I open this project?
In my "workspace" I have created a subdirectory called "game". I copied all my .java files into this subdirectory. Then with Eclipse, I created a new project with the name game. As a result, Eclipse created .classpath and .project files in the directory "game". It also created bin and src subdirectories. And now I think it is not the correct way to go. The source files are supposed to be in the "src" directory. Right? And at the moment all my .java files are in the "workspace\game".
I did it another way around. With Eclipse I have created a new project with the name "game". As a result, Eclipse created a folder called "game" into folder "workspace". In "game" the folder I found the "src" folder. I copied all my .java files into this folder. But now in the "Package Explorer," I cannot open the "src" folder. So, how can I access my source files from Eclipse? Why Eclipse does not want to open the "src" folder?
[Updated on: Mon, 17 February 2020 09:39]
Report message to a moderator
|Re: How to create a project from existing source in Eclipse and then find it? [message #1861085 is a reply to message #1821391]
|Tue, 19 September 2023 09:20
| James Millere
Registered: January 2023
To migrate your Java project to Eclipse and resolve the issues you're facing, follow these steps:
Launch Eclipse if it's not already running.
Create a New Workspace (Optional):
If you prefer, you can create a new workspace in Eclipse. Workspaces are used to organize your projects.
Go to File > Switch Workspace > Other... and choose or create a new workspace location.
Import Existing Project:
To import your existing Java project into Eclipse, go to File > Import.
Select Import Source:
In the Import dialog, expand the General category and select Existing Projects into Workspace. Click Next.
Browse for Your Project:
Click on the Select root directory button and browse to the directory where your .java files are located. This should be the directory that contains your project.
Select Your Project:
You should see your project listed in the Projects field. Ensure it is checked.
Finish the Import:
Click Finish to import your project.
Adjust Project Structure (If Needed):
By default, Eclipse will create a project in your workspace with the same name as your original project folder. Inside the project, Eclipse will create a "src" folder for your Java source files.
Review Package Explorer:
In the Package Explorer on the left side of the Eclipse window, you should see your project. Expand it to see the "src" folder, which should contain your .java files.
Compile and Run:
You can now compile and run your Java project directly from Eclipse.
Remember that you don't need to manually copy files into Eclipse's workspace directory. Eclipse manages project files internally, and you work with them through the workspace.
If you encounter issues with project names, make sure that Eclipse's workspace doesn't already have a project with the same name. If it does, consider deleting the existing project from the workspace (but not from disk) or choose a different project name during the import process. You may consider this Power BI course source.
Following these steps should allow you to open and work with your Java project in Eclipse, with your source files organized in the "src" folder.
Powered by FUDForum
. Page generated in 0.03613 seconds