Destination Folder must be accessible (Eclipse) - eclipse

When i Try to drag and drop a file into eclipse it gives me the error "Destination folder must be accessible." so i can't get it into my workspace.
Can anyone help?

You cannot drag and drop files into an empty workspace. You first need to create a project:
File > New > Project...
Or if you like to open a directory as a project:
File > Open Projects from File System...

The accepted answer is correct, but it is not the only way of getting that error message. For completeness sake, you can get "destination folder must be accessible" by:
Dragging the file into an empty Project Explorer.
Solution: Create or import a project in the Project Explorer, then try again.
Dragging a file into a blank area in the Project Explorer.
Solution: Drag the file onto a container, such as the project or a folder in the project.
Eclipse is part of the problem. It accepts the drop only to display an error dialog. It would of course be better if Eclipse provided feedback while dragging so unacceptable destination locations would display the appropriate mouse cursor (circle with a line through it) and not accept the drop.

Related

Open external files with eclipse ---> Error: "The default workspace is in use or cannot be created"

I need to open certain files (.java, .js, .html ...) with eclipse but when I try to do it I get the following error:
"The default workspace is in use or cannot be created"
How can I solve? Thank you.
Usually you have to import projects to meaningfully use your files.
Otherwise, you just get a, for example, .java or .class file that you cannot do anything.
If you are importing an existing project, check this link: https://www.360logica.com/blog/how-to-import-a-java-project-into-eclipse-ide/
Another option is, copying and pasting your existing file in the workplace folder that eclipse points to. Then go into eclipse and create a new project with the exact same name. At this point, eclipse should recognize the project and show it in the left project explorer window.
I have my project/s on Eclipse with obviously my workspace/s. If for example I have the ide open because I'm working on a workspace I can not open external files. I would like them instead to open up in my current work area.

Eclipse project already exists

I deleted a project in my workspace, then tried to create a new project with the same name. Eclipse told me that it overlaps the location of another project (the one I just deleted). How do I fix this?
This is what I did.
Go to Window --> Show View --> Project Explorer
Then right click on the project name that you want to delete and Click Delete.
In the dialogue box, check 'Delete Project Contents on disk'
It worked. I was able to create the project with same name again.
I had the same problem with the IBM Integration Toolkit, which is based on Eclipse. The problem also occurs in Android Studio, which is also based on Eclipse. crazyscot seems to have the right answer at A project with that name already exists in the workspace eclipse and his solution worked for me.
You need to open up the Project Explorer view (it may already be open) and delete the project from within there.
Go to Window >> Preferences >> General >> startup and shutdown >> workspace
theen select Recent work space then click Remove and close the program and open it again
You have to manually delete the project folder from your "workspace" directory (wherever you have defined it to be).
there will be a file .project xml file in the project and its content looks like
<projectDescription>
<name>ProjectName</name>
.
.
.
</projectDescription>
here ProjectName is the name of project you can change it to whatever you want.
First you create a project in some other location with the same name of your project as before.
Now delete this project by right clicking on project > Delete.
Do not check the dialog "Delete Project Contents on Disk".
Now you move your newly created project through file manager to the original location(location where you are not able to import your project).
Then import the project from the newly moved location(location where you are not able to import your project).
After deleting the project from Eclipse IDE(Project Explorer), remove it from work space folder as well. Workspace folder path - C:\Users\username\workspace (it can be different for your system).
try moving the project and try importing
go to tab window>preferences>search workspace> then make sure in last / is not in your recent workspace. Example-:/var/www/html
your url should like above.
With the same problem, I did a text search and found an XML file containing the name of the project.
I had copied the project from another project. Let's say that I copied project A to project B. Although the XML file in the new project (B) was named for project B, it had an entry which still referred to project A. When I edited it, the problem went away.
Simply remove the .classpath and .project files and try.
Go to create new project. Once there, select the project type. Mine was PHP project. The new PHP project screen will popup. There, click create a new project and give the project name which you used before. Then press finish.
If you need a 100% risk-free strategy, just right click the project and select 'export', and put it back where it was. Then, you can either continue using the project in your current directory (with no more popups) or switch over to the directory you were working in before. The side effect of the former is that you will have a duplicate project taking up a small amount of space. If anything, finish up what you need to do in the current directory, then pull (via git) from the original directory. Or, delete the project in the current directory, and import from the original directory to the target directory for the second time - though now, since it is the proper way, the issue will be resolved.
I met this problem just and I just figure out the main reason cause this problem is your copying pom.xml from another already existing project in your workspace.
So the way is find the pom.xml in your project folder and rename <name>conflicted Project name</name>.
In 2021, Using Ubuntu 20 here is simple way to remove it.
In Eclipse main Menu
Window -> Preferences
In the search type recent workspaces
Select and delete the project. click apply changes
Removing a project from an Eclipse workspace does not delete the files by default. You have to check a checkbox for that. This is a Good Thing. As you have not checked the checkbox, you have to delete the files manually using e.g. a file manager.
Note that there are files starting with . in an Eclipse project directory, such as .project. They are considered hidden files on Unices.
go to the folder and delete the file .project. This worked for me.

Delete source folder in PyDev project generates error "Source folder not found"

When deleting a source folder in a PyDev project in the Project Explorer, the project PYTHONPATH is not updated and there is a red x marking in the outline with an error message saying "Source folder: [source folder name] not found".
Is this really the intended behavior? I would expect the PYTHONPATH to be updated if source folders are removed.
I'm using PyDev version 2.7.3 and Eclipse 3.7.2.
Steps to repeat the problem:
In Project Explorer, create a new PyDev project with File -> New -> PyDev Project
Create a new PyDev source folder by right-clicking the new project and selecting New -> Source Folder (under the PyDev menu)
Remove the source folder (which was just added) by right-clicking the source folder and select Delete.
Add a new source folder (needed to trigger the error).
There is a red x error mark and a message saying "Source folder: [source folder name] not found".
Go to PyDev Properties. The deleted folder is still listed in the Source Folders tab under PyDev-PYTHONPATH.
Note: When repeating the steps above in the Package Explorer instead of the Project Explorer, the red x's don't show up - so you can't see there is a problem. However, if you look in PyDev properties the behavior is the same - PYTHONPATH is not updated.
Right click on your project folder->Properties->PyDev - PYTHONPATH. Select the directories causing the errors and click Remove on the right.
Looks like the problem happens when project name doesn't match directory name.
e.g.,
env/VersionModifier/src/myfile.py
.project file = CoolTool
source folder not found
env/VersionModifier/src/myfile.py
.project file = VersionModifier
OK
You could call it a bug or an "enforcement of best practice" but right clicking on the project and making its name match its enclosing directory fixed the problem for me in Kepler.
Good luck
Peter
the way i resolved it is to go to the folder in which your code is stored and find a file by the name of .pydevproject. It is an invisible file in eclipse/aptana so you may have to do this through cli or file browser. look for a structure that look like <path>path/to/your/file</path> and delete the ones that show errors in your package explorer. this will resolve your problems for now, but this is a bug and needs to be reported.
I think the problem stems from the fact that pydev fails to remove the <path>...</path> vars once the user deletes the source folder.
Below is how I resolved this, hope it helps.
Clean Up:
Removed the project from eclipse; of course, leaving it as on disk.
From the source directory removed ".project" and ".pydevproject" files.
Recreate:
Created a new PyDev project (in eclipse), providing the existing source directory. In the New Project dialog, selected "Create 'src' folder and add it to the PYTHONPATH".
The project got created properly, without any source-folder errors.
Now add the folder you want to add as source directory, by right-clicking the folder and selecting the option under "PyDev".
At the end, you may just delete the "src" directory that was created by eclipse.

Is there an equivalent of "Add existing file" (to project) in Eclipse?

I am trying to map my Visual Studio experience onto Eclipse. Right now, I wish to add a file existing somewhere on the file system into a project in Eclipse. I expect it to be copied to the project source folder.
Currently, I see only one way - switch to the windows explorer (total commander, in my case) and copy the file myself, after which to refresh the project.
Can I do the same without leaving the Eclipse IDE?
Thanks.
I had the same problem, but found yet another solution.
Let me state my problem so that we're sure we're talking about the same thing.
I had a file in a directory where a bunch of code files were and some of the files in that directory were shown as "in my project" and some of the files were missing. I wanted the missing files to appear in my project.
I simply selected the folder in my project and pressed 'F5' or right-clicked and selected 'refresh' and the files appeared in my project. It looks like that is the intended way of doing this.
File->Import->General->File System should do it.
There you can select the file(s) from some file system folder to your project (into folder).
Even easier. Just drag and drop the file from explorer into the correct package in Eclipse. It will ask you if you want to copy or link the file(s).
I am a newbie to Eclipse Luna (the 64 bit latest version on Windows 7) but this worked for me:
Copy the preexisting source files you which add to your project.
In Project Explorer, right click your project and select New > File
In the "New File" dialog box, your project's name / folder should be displayed as the parent folder for your new (existing) source file.
Click on the "Advanced" button at the bottom of the "New File" dialog box.
Check the "Link to file in the file system" checkbox.
Click the "Browse" and browse to your preexisting source.
Click the "Finish" button at the bottom of the dialog box.
In my case, I had to:
right-click the project's name
choose "Close Project"
right-click the (now closed) project's name again
choose "Open Project"
Refreshing didn't work for me. :(
Hopefully this helps someone else...
Just found the quickest way to add files:
Copy-paste your file into your project disk directory using your file browser.
In Eclipse project browser select your project.
Click [right mouse button]->Refresh (or press F5 on Windows machine).
Voila
(worked on Neon-4.6.2)
I just got this to work. YMMV
I don't suppose it has to be there, but I put my file, xyz.cpp, into my project's source directory. My project has a source subdir named src, as in ProjName/src.
Right Click on project name (my project was open and the only one open).
NEW->FILE. Put in the filename, xyz.cpp. Click OK or press enter.
The file will open in the editor and complain that it is empty. Close it WITHOUT SAVING.
Reopen the file. It now has its contents.
It turns out that just simply dragging the files into the src folder would work!
Right-click on the file after you have copied it into the project directory. Select Properties... in the left hand pane select C/C++ Build. There will be a checkbox "Exclude resource from build" uncheck that check box.

Eclipse: How to add an existing source folder?

I have a directory called c:\RemoteSrc . Under this there are 3 directories which are currently source folders (I think? the icon is an open folder with a little orange grid in it) in my Eclipse project. I have dropped a new directory under c:\RemoteSrc which I also want to add to my project.
BUT
If I right click on my project and go "Build Path..." -> "Link Source" and try to add it it tells me "Folder already exists with a different case". Yes i KNOW that the folder already exists THATS WHY IM TRYING TO ADD IT.
I think all you need to do is refresh the project. Eclipse does not automatically pick up folders (or files) dropped into it's project directory.
A screen capture might help, but if the GUI is un-cooperative, you can:
close Eclipse
open the .classpath file which defines your project (it may be located in your workspace)
see if you can define a new classpathentry of kind "src": this is not the easy method, but that may give you an idea why the GUI refuses to define the same entry.
For Linked Sources, you should have something like the following in your .classpath
<classpathentry kind="src" path="module_name"/>
With a corresponding matching entry (within <linkedResources>)in your .project
<link>
<name>module_name</name>
<type>2</type>
<location>path/to/your/module</location>
</link>
NOTE: Removing a linked project doesn't necessarily remove it from the project.
No need to close Eclipse.
Open .project file using Notepad++, find link to the existing source/folder and delete it. Save the file.
Refresh the project in Eclipse.
Now you should be able to link it again.
I had a problem where I had created a /src directory in my working directory and then wanted to link another directory with additional files to import. The "existing directory" turned out to be because the directory I was trying to link was also called "/src", even though the path was different. I guess Eclipse can't have two /src directories in the same project, similar to trying to mount two file systems at the same node. I rearranged the directories so there was only one /src, and all was well.
There were conflicts when I tried to update my project which resulted in creation of multiple .classpath files.. SO removing the copies and reverting the latest .classpath file and then refreshing/rebuilding project ,solved the issue for me.
Hope it helps!
Sometimes the simple refresh (Greg Adamski's answer) does not work, e.g. because the source folder is not in the src-directory (in my case, I had to reference Swagger auto-generated code which was located deep in the target/.... directory after a Maven Build).
In this case, right click the project, open the 'Build Path' -->'Configure Build Path' dialogue, select the 'Source' tab and select your additional source folder via the 'Add Folder' button.