Eclipse doesn't show projects in package explorer - java

I keep my workspace folder in the Dropbox folder so I can use it on different computers. Usually there isn't a problem. Today however I opened Eclipse and found it doesn't show the projects in the package explorer.
I checked and it's set to the correct workspace folder.
I tried to Import existing projects into workspace, but Eclipse doesn't allow importing the projects because 'they already exist in the workspace' - even though they don't appear.
Will appreciate your help.

Keep your project files in DropBox. You shouldn't share a workspace like that -- it will inevitably lead to issues like the one you describe.
That is, keep the project folder, along with the .project, .classpath, and .settings/ in your shared Dropbox space. Create a new workspace on each computer, then "Import existing project" into each workspace, selecting your project in Dropbox, being sure to unselect "copy projects into workspace".

I don't have idea about using dropBox-BUT-However
For your question::
I tried to Import existing projects into workspace, but Eclipse doesn't allow importing the projects because 'they already exist in the workspace' - even though they don't appear.
Possibility:: Projects are not in Eclipse explorer but a copy of it exists in the workspace folder so eclipse is not allowing you to add the projects with same name again.
Solution:: Create a new workspace and then use dropbox to import the projects.

What you can also try is do
Create new General Project
Select in current workspace
Create project with name of an already existing project in your workspace
I seem to remember using this to "hydrate" already existing projects in my workspace into the eclipse package explorer.

This happened to me and it was because I inadvertently filtered out some of the files in the filters option in the Package Explorer.
Inside PackageExplorer -> Small drop down on top right side -> Filters
Un-select all and see if your files are now visible. Worked for me.

Related

import project from workspace in eclipse

I have problem with importing projects from workspace into eclipse even though I am able to check the projects (which shows checkable).
After I hit the finish button, there is an error which says
"Some projects can not be imported because they already exist in the workspace or their project description file is corrupt."
I have already deleted the projects from workspace so that let me be able to check from the import box.
So I guess that "project description file is corrupt" is the cause.
Can you help me out to fix it. I will appreciate it in advance.
I would suggest start from scratch ,including choosing new location for Workspace.
If all of your old projects exist in a single directory or in a single parent directory, you can do File -> Import... -> Existing Projects into workspace. Choose a root directory that is a parent all of the projects you want to import. You will then be able to import project/projects at once.
Change your workspace it will work fine.
The below issue solved my issue:
Navigate to your workspace.
Copy the existing project you want to import somewhere else.
Now import the existing project in the eclipse.
It should look like below image after copying

How to import a spring project in STS

Just by a mistake I had deleted a spring project in STS.To use it back I borrowed the same project from my friend in zip format but when I tried to import it says
Some projects cannot be imported because they already exist in the workspace
Following is the way I tried to import
file->import->general->existing projects into worspace->select archive file
and after browse when I select the zip project
Some projects cannot be imported because they already exist in the workspace
and the finish button and next button are in disabled state.Please help me
The workspace in STS/Eclipse is not automatically the same as the file structure that you have on disc in your workspace directory. You can have projects in this workspace folder or somewhere else on disc.
To get them into your project explorer (and access them from inside STS/Eclipse), you need to import them (Import Existing Projects into Workspace). Then you can select the folder where those projects are located in. In case you have those projects already in your workspace folder on disc, you can choose the workspace folder as root folder in the wizard. It will show all the projects that exist on disc in that folder and grey those out that are already imported/referenced in your workspace in Eclipse.
Make sure it is really not in workspace, also if there aren't any other projects with the same name. If not, just delete the .metadata folder or create a new workspace.
Check if you still have the project in folder of the workspace on disk. You may have deleted in STS, without checking 'Delete on disk'. So, the project may be still there in the workspace folder though its deleted in STS.
I get this issue from time to time. Usually I just open a new workspace but sounds like you don't want to loose other projects.
I simply open the.project file in my project and change the name of the project in name tag.
Good Luck!
Probably whey you 'accidentally deleted' your project, you only deleted it from the Eclipse workspace, but not from the actual workspace folder on your hard-drive (as other people pointed out, Eclipse can arbitrarily map workspace projects to files on disk, so it is possible for a project to be 'deleted' from your Eclipse workspace but still exist on disk.
The good news is the files you deleted are actually still there.
Instead of importing your project from a zip, you may just want to import those files from the workspace folder back into your Eclipse workspace.
Generally this kind of problems not occurred you can go to Project option and clean and than restart STS.
May be STS is not synched with the latest configured project.
When you launch Spring Tools Suite, it will ask you to Select directory as workspace as below:
If the directory you selected here (i.e., workspace directory) is the same as the directory where the project that you are going to import resides, then you will get Some projects cannot be imported because they already exist in the workspace.
Therefore, to solve the issue,
Close Spring Tool Suite
Create a new directory
Launch Spring Tool Suite again
And, select that as your workspace
Launch the application and you would be able to import as you mentioned in your question
It solved my problem.
Hope it helps..
Happy Coding!!
the problem is that when you delete a project maybe sts only close it.
Try View Menu --> uncheck closed projects
Now you will see all closed project, simply delete it.

Why doesn't Eclipse recognize my Eclipse projects?

I tried to rename my top level folder which contains multiple java projects. I also wanted to create a new workspace to point everything to the right location. My current workspace has all the right projects in it, but when I go to import the copied projects into my new workspace, they don't show up. I checked each projects .classpath and .project files and they seem to be the same. I thought as long as they have a .classpath and .project eclipse should recognize them and be able to import them but they don't show up. I looked in the workspace files but don't see anything there that seems of value. What other files do my projects need to be picked up by Eclipse? I'm not even sure how I got them into my current workspace to begin with.

Can one import an entire workspace into eclipse?

I have searched around the interwebs and have failed to find the answer to this question so I thought I would ask the wise people here.
I reformatted my computer recently and I backed up all my data including my Eclipse workspace but I failed to export my projects using Eclipse itself. I replaced my workspace file back into Eclipse but it does not show any of my projects as run-able Eclipse projects. Is there a provision to import a whole workspace into Eclipse? Is there information in other files that Eclipse requires or will I just need to manual rebuild the project? Thanks for your help and advice all.
You need to browse earlier workspace. Projects inside workspace automatically appears in project panel. However if they don't, goto File-> import menu and select "import existing" and browse to project folder in workspace. It should work.
You can right click on the Package Explorer and select Import. There is an option called Existing projects into workspace. Select that and then select your folder. It will show importable projects. Select them all and import.
You can open directly a Workspace created with an earlier version Eclipse. The new instance will then update the Workspace to the newer metadata configuration. This might prevent earlier Eclipse versions of opening the updated Workspace.
To deal with this I keep Workspaces of different Eclipse versions in different folders, in a structure like this:
Eclipse.Neon
├── Workspace.DomainA
└── Workspace.DomainB
Eclipse.Oxygen
├── Workspace.DomainX
└── Workspace.DomainY
If I wish to import, say, DomainA to Eclipse Oxygen I simply copy it to the Eclipse.Oxygen folder:
cp -r Eclipse.Neon/Workspace.DomainA Eclipse.Oxygen/
And then open that Workspace with Oxygen.
One final note: Workspace management is considerably easier if projects are kept outside its folder, e.g. in a general code versioning folder like git or svn.

How do I start a new project in Eclipse and Subversion

A newbie question (I haven't really created new projects in Eclipse yet): I have a machine running Linux with a fresh install of Eclipse 3.5.2. I want to create a new Java project in an existing subversion repository (which already contains some unrelated stuff). So after running Eclipse I get this dialog to specify workspace. What is the best practise here? Should it be in subversion? Then when I created a random one, when I add a project it goes into the workspace. So if my workspace is not in subversion, where and how should I get these projects there?
Background: probably I will work on my own on this project, however I have 2 PC's which I want to be able to use interchangeably.
What I usually do is put the workspace out of the way in ~/.workspace (invisible directory). Then I create new projects outside of that workspace, in the Subversion checkout directory.
You can create a project outside the workspace as follows:
Create a directory in your Subversion repository. Your project will live in this directory.
In Eclipse, click File; New; Project.
Choose the desired project type; click Next.
Instead of "Create new project in workspace" (the default), select "Create project from existing source". The name is misleading: the source does not have to exist, just the directory!
Click Browse and select the directory that you just created.
Eclipse will create a .project file and other support files in the directory you specified. Simply add all these files to Subversion, and you're all set.
Your workspace is the folder where eclipse will place all of your projects.
Basically, once you've linked Eclipse with a SVN repository, retrieving a SVN project will send him to the workspace, thus allowing you to work on it. Once you've made the changes, you can right click on your project in the project bar (on the left, by default) and chose ->team/subversion (depending on the eclipse version) -> commit.
If you want to send a project into your subversion, you create a new project inside your workspace. Then, you right click on the project in your project bar and do the same thing.
let's say that your workspace dir is /home/grzenio/workspace and your project name is project
first of all, go to to /home/grzenio/workspace, then checkout the source code, so the code will be at /home/grzenio/workspace/project.
Open eclipse, and create a new project from the folder selecting "Create project from existing source". Select /home/grzenio/workspace/project
Voilá!

Categories