Accepted answer

just delete the .lock file in the .metadata directory in your eclipse workspace directory.

precaution - if you delete the .metadata folder all preference will be deleted.


the answer @boris gave is correct 99% of the time, however it can also happen if you open the workspace in an older version of eclipse. a workspace imported into/created with juno will throw this error when opened in galileo.


another all-too-common reason for this problem is if you attempt to load a directory on a drive that is no longer connected. for example, say you program in c:\code\java, but occasionally work off of a flash drive, h:\code\java. if you do not have the drive connected it can be easy to believe you are trying to load a valid directory without noticing your typo.


another problem is when eclipse doesn't have write access to your src folder. change the security permission and make sure "authenticated users" are added with all permissions checked but full control & special permissions.


i had this error after i restarted the system (after a long time. normally i just make it sleep). found out that once i mounted the drives (by clicking and opening it) where project folder is located, and relaunching eclipse, solved the issue for me.

ps: i'm an ubuntu user.


here are a few steps to solve it the no. 4 step is works for me.

  1. delete .log files along .metadata folder.
  2. check the current user permission make sure to check the full control checkbox click apply then ok.
  3. if you run system drive defragmentation or maintenance before you run eclipse editor sometimes original file path are not in their respective path to make sure run "previous version" time before your system maintenance of your drive where the eclipse workbench or something similar to this was saved.
  4. this last option is works for me. check the drive letter of your current drive where the code editor was saved. if something unusual e.g before your maintenance your drive letter is k then after defragment or maintenance. the drive letter is now l hence you should change the drive letter to its original one that is k. to do this click the ff: open control panel system & security administrative tools computer management disk management in disk mngt choose the drive example l then right click > change drive letter & path > click remove > then ok, open it again then > click add and > choose your original drive letter for that drive then click ok. if you use your computer for a long period of time do restart first to refresh everything.


choosing a "different one" is actually a pretty easy solution.

i had been running eclipse as an administrator (sudo eclipse from the command line) because the "workspace" folder was throwing the workspace in use or cannot be created… error (and running as administrator seemed to be the only solution that fixed it).

a coworker (working on this same issue with me) wanted to run eclipse by clicking on an icon. so when he ran eclipse, and the dialogue box came up with the choose your workspace, he just added a "2" to the end of "workspace".

this created a new folder: "workspace2". eclipse ran fine with that; and i haven’t had any of the locking problems since.


it will occur when you not closed eclipse.exe correctly.

*open task manager->end task your eclipse->now open eclipse.exe it will work.

hope its help someone.


i have observed one case when eclipse when in forced quit, or alt-f2 xkilled in linux, an attempt to immediately open eclipse shows that error. even the metadat/.lock file is not present in that case. however it starts working after a span of about two minutes


i don't know what's the wrong but i solved by creating a directory directly in c drive(c:\dev) instead of from my home folder (c:\users\me\dev). but i don't have to thinks about it. in my case, it is fresh eclipse unziped instance. i am not able to see .matadata folder in eclipse folder. by god grace, i solved.


the reason this was happening to me (with photon) was easily fixed by changing an eclipse general preference:

window -> preferences -> general: uncheck: "always run in background"

once you make that change, whenever you shutdown eclipse, it will no longer leave the javaw.exe process running in the background. i’m guessing this is a bug in photon (or a bug with using the amazon corretto openjdk version of java with eclipse) that will one day be fixed.


i faced the same problem, but for some reasons the .lock file in workspace was not getting deleted. even creating a new workspace was also getting locked.

so what i did was cleaning the windows temp folder, the %prefetch% folder and %temp% locations. restart the system and then it allowed to delete the .lock file.

maybe it will help someone.


it seems your workspace is used in java tm, open task manager and close eclipse.exe and java tm process.


what worked in my case was restarting the system. (ubuntu 20.04)


if anyone have come here with a stm32cube related issue, which apparently is based on eclipse and has the same problem, none of the above suggestions worked for me, and here is how i fixed it, for linux, although i suppose you can find the corresponding paths in windows as well.

in the $home directory, go to .eclipse/

the file org.eclipse.ui.ide.prefs contains few options including the recent workspace path, and whether it will prompt you to select a workspace at the startup. either modify the path for recent_workspaces, or enable show_workspace_selection_dialog.


in my case, there was a space right before the workspace's location c:\. i removed that space and it was enough :)


for mac users:

it could be that another instance of eclipse is running in the background. if so, use either force quit eclipse or

ps -ef |grep eclipse
kill -9 pid

to all the eclipse instances, and start the new workspace


start eclipse with the option -dosgi.locking=none.

i got the trick here and it works.

don't do this unless you know nobody can work on the same file at the same time.


please try to end task eclipse from taskbar. it works for me.


at times, if you are on windows, you may not see all the processes - or the culprit process in task manager. i had to click 'show process from all users' and there was this java.exe that i had to kill in order to get back my workspace.


another possible case if none works is to see that there is a running java application . may be your previous open and close has left unkilled java instances.

  1. do look for any java instance is running if there are two at least you need to kill one.but ,most of the time i kill any java running :) because that java is using the work space earlier and still will if don't kill it.

  2. change another work space in case if you want a multiple ide to use and work on diffrent or same project , but you should import project form workspace after you open your ide.


i was faced this issue when ever the eclipse is not closed (kill eclipse process the from task manager or computer power off), i was tried below steps, it worked for me.

1) remove the file names start with ".filetable" from this folder


2) remove the log files like text files start with numeric names from this folder


3) open command prompt(cmd) navigate to this folder


type below command

eclipse clean start

enter image description here


deleting logs and .lock didn't work but

-clean option fixed it for me.


there is another case where the path to the workspace may not exist, e.g., if you have imported preferences from another workspace, then some imported workspace addresses may appear in your "open workspace" dialog; then if you didn't pay attention to those addresses, you would get the exact same error once you tried to open them.


running eclipse in administrator mode fixed it for me. you can do this by [right click] -> run as administrator on the eclipse.exe from your install dir.

i was on a working environment with win7 machine having restrictive permission. i also did remove the .lock and .log files but that did not help. it can be a combination of all as well that made it work.


another possible cause of the “workspace in use or cannot be created, chose a different one” issue is that the real path to your workspace may have changed.

in my case, the real location of the workspace had changed, but i had used a symlink to make it look like it was in the same location. i saw errors in logs indicating that eclipse was looking at the previous "real" location, as opposed to following the symlink, and this was causing the errors.

in my case, i just moved the workspace back to its old location.


go to taskmanager(right click in the task bar) and select processess menu bar and select eclipse.exe and click endprocess


i've seen 3 other fixes so far:

  1. in .metadata/, rm .lock file
  2. if #1 doesn't work, try killing the process javaw.exe etc. then rm .lock file
  3. if #1 and #2 don't work, try rm .log file in .metadata/, and double check .plugin/.
  4. this has always worked for me: relocate .metadata/, open and close eclipse, then overwrite .metadata back

the solution boils down to cleaning up the .metadata folder.

Related Query

More Query from same tag