How to create a project from existing source in Eclipse and then find it?
- Go to
File
>New
>Java Project
- Uncheck
Use default location
- Click
Browse
, navigate and select the source folder. - Confirm by clicking
Finish
.
Finding the project is as easy as opening Package Explorer
or Project Explorer
Sidebar.
No-nonsense guide to file integration and conflict resolution
Bringing a new tenant to your Eclipse "apartment building"? Let's prevent possible neighbor disputes with these recommendations.
Rooming the files together
Put your .java
& .class
files in one directory. It's their new home base. Trust me; it saves headaches later.
Slaying the dragon named 'package conflicts'
Make sure your package names match the directory structure. Eclipse hates package declaration mismatches. A little tip: If you meet that dragon, use the magical Ctrl + 1
to summon quick-fix suggestions.
The manual way: Files to src
folder
If you prefer the old-school way, drag the files into the src
folder. Remember to tell Eclipse to copy, or they will disappear from their previous location.
Clean bill of health
Compile and run the project to check if everything is still talking to each other. A successful run means your setup is ready.
Strategies for file organization and troubleshooting
Here are tips on managing imports and troubleshooting.
Importing projects into workspace
File
> Import
> General
> Existing Projects into Workspace
is a smart move when initiating a lease with an established tenant.
Project type matters
Importing files in Eclipse is like hosting a party. You've to know the type of the party (Java or Web project) first and set up everything accordingly.
Handling special cases
If you've got a rebel project that does not want to conform to the Eclipse structure, create a new package. You can do this through File
> New
> Package
.
Make life easy, sometimes
It's not always about bucking the system. Using the default location can work to your advantage when creating a project.
Was this article helpful?