Eclipse说:“使用中的工作区或不能创建的工作区,选择了不同的工作区。“如何解锁工作空间?”

时间:2023-01-15 08:50:18

When I start, Eclipse says "Workspace Cannot Be Locked"

当我开始时,Eclipse说“工作区不能锁定”

"Could not launch the product because the associated workspace is currently in use by another Eclipse application." or “Workspace in use or cannot be created, chose a different one.”

“不能启动产品,因为相关的工作空间目前正在被另一个Eclipse应用程序使用。”或“使用中的工作区或不能创建的工作区,选择了不同的工作区。”

But I know it isn't.

但我知道事实并非如此。

How do I "unlock" it?

我如何“解锁”它?

18 个解决方案

#1


490  

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

只需删除eclipse工作区目录中的.metadata目录中的.lock文件。

Precaution - If you delete the .metadata folder all preference will be deleted.

预防——如果您删除了.metadata文件夹,所有的首选项将被删除。

#2


36  

I've seen 3 other fixes so far:

到目前为止,我已经看到了其他3个补丁:

  1. in .metadata/, rm .lock file
  2. 在.metadata/, rm .lock文件中。
  3. if #1 doesn't work, try killing the process javaw.exe etc. then rm .lock file
  4. 如果#1不起作用,尝试杀死进程javaw。exe等,然后是rm .lock文件。
  5. if #1 and #2 don't work, try rm .log file in .metadata/, and double check .plugin/.
  6. 如果#1和#2不起作用,请在.metadata/和double check .plugin/中尝试rm .log文件。
  7. This has always worked for me: relocate .metadata/, open and close eclipse, then overwrite .metadata back
  8. 这对我来说一直很有效:重新定位。元数据/,打开和关闭eclipse,然后覆盖。元数据。

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

解决方案归结为清理.metadata文件夹。

#3


12  

Go to TaskManager(Right Click in the Task Bar) and select Processess menu bar and select eclipse.exe and Click EndProcess

转到TaskManager(在任务栏右击)并选择Processess菜单栏并选择eclipse。exe并单击EndProcess

#4


11  

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.

在我的例子中,工作空间的实际位置发生了变化,但是我使用了一个符号链接,使它看起来像是在同一个位置。我在日志中看到了错误,表明eclipse正在查看以前的“真实”位置,而不是遵循符号链接,这导致了错误。

In my case, I just moved the workspace back to its old location.

在我的例子中,我只是将工作空间移回原来的位置。

#5


7  

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.

还有另一种情况,即工作区的路径可能不存在,例如,如果您从另一个工作区导入了首选项,那么一些导入的工作区地址可能出现在您的“open workspace”对话框中;如果你不注意这些地址,一旦你试图打开它们,你会得到同样的错误。

#6


7  

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.

在管理员模式下运行eclipse为我修复了它。您可以通过[右击]->作为管理员在eclipse上运行。从您的安装目录删除。

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.

我在一个工作环境中,win7机器有限制性的权限。我也删除了.lock和.log文件,但这并没有帮助。它可以是所有的结合,使它起作用。

#7


2  

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.

有时,如果您在Windows上,您可能不会看到所有的进程——或者任务管理器中的罪魁祸首进程。我必须点击“来自所有用户的显示流程”,还有这个java。为了找回我的工作空间,我不得不杀了他。

#8


2  

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.

如果没有工作,另一个可能的情况是看到有一个正在运行的Java应用程序。可能是您之前的打开和关闭已经留下了未被杀死的java实例。

  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.

    如果有两个至少需要杀死一个java实例,那么要查找任何java实例。但是,大多数情况下,我要杀死任何java运行:),因为java使用的是早期的工作空间,如果不杀死它,它仍然会使用。

  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.

    如果您想要使用多个IDE来使用和处理不同的项目,那么需要更改另一个工作空间,但是在打开IDE之后,您应该导入项目表单工作区。

#9


1  

deleting logs and .lock didn't work but

删除日志和。lock没有工作,但是。

-clean option fixed it for me.

-clean选项帮我搞定。

#10


1  

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.

当eclipse没有关闭时,我就遇到了这个问题(kill eclipse process从任务管理器或计算机电源关闭),我尝试了下面的步骤,它为我工作。

1) Remove the file names start with ".fileTable" from this folder

1)删除文件名以“开始”。从这个文件夹文件表”

C:\eclipse\configuration\org.eclipse.osgi.manager

C:\ eclipse \ \ org.eclipse.osgi.manager配置

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

2)删除像文本文件这样的日志文件,从这个文件夹开始使用数字名称。

C:\eclipse\configuration

C:\ eclipse \配置

3) Open Command prompt(cmd) navigate to this folder

3)打开命令提示符(cmd)导航到该文件夹。

C:\eclipse

C:\ eclipse

type below command

输入下面的命令

eclipse clean start

eclipse干净的开始

Eclipse说:“使用中的工作区或不能创建的工作区,选择了不同的工作区。“如何解锁工作空间?”

#11


0  

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.

@Boris给出的答案在99%的时间里都是正确的,但是如果您在旧版本的Eclipse中打开工作空间,它也会发生。当在Galileo中打开时,一个与Juno一起导入/创建的工作区会抛出这个错误。

#12


0  

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.

另一个非常常见的原因是,如果您试图加载一个已不再连接的驱动器上的目录。例如,在C:\Code\Java中编写程序,但偶尔会在闪存驱动器上工作,H:\Code\Java。如果您没有驱动器连接,那么很容易相信您正在尝试加载一个有效的目录,而不注意您的输入错误。

#13


0  

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.

另一个问题是,当eclipse没有对您的src文件夹进行写访问时。更改安全权限并确保“经过身份验证的用户”被添加到所有权限检查但完全控制和特殊权限。

#14


0  

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.

在我重新启动系统(经过很长时间之后)之后,我有了这个错误。通常我只是让它睡觉)。发现一旦我安装了驱动器(通过点击和打开它),项目文件夹所在的位置,并重新启动eclipse,解决了我的问题。

PS: I'm an ubuntu user.

PS:我是ubuntu用户。

#15


0  

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

这里有几个步骤可以解决这个问题。4步对我来说是有效的。

  1. Delete .log files along .metadata folder.
  2. 删除.log文件沿着.metadata文件夹。
  3. Check the current user permission make sure to check the full control checkbox click apply then OK.
  4. 检查当前的用户权限,确保检查完整的控制复选框,点击应用即可。
  5. 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.
  6. 如果您在运行eclipse编辑器之前运行系统驱动器碎片整理或维护,那么在您的驱动程序的系统维护之前,有时原始的文件路径并不在它们各自的路径中,以确保在eclipse工作台或类似的东西被保存之前运行“以前版本”。
  7. 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.
  8. 最后一个选项对我有效。检查当前驱动器的驱动器号,代码编辑器保存在那里。如果有什么不寻常的e。在你的维修之前,你的驱动器号是K,然后是碎片整理或维护。驱动器现在L因此你应该改变驱动器到原来一个k .单击ff:打开控制面板系统和安全管理工具计算机管理磁盘管理磁盘mngt选择驱动的例子L然后右键>更改驱动器号和路径>点击删除>然后好,再次打开它然后>单击add >选择你的原始驱动器,然后单击ok。如果你用你的电脑很长一段时间,首先要重新启动来刷新所有东西。

#16


0  

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).

我一直在运行Eclipse作为管理员(sudo Eclipse从命令行),因为“workspace”文件夹正在使用或不能创建…错误(并且作为管理员运行,这似乎是唯一的解决方案)。

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".

一位同事(和我一起处理这个问题)想通过点击图标来运行Eclipse。因此,当他运行Eclipse时,对话框会选择您的工作区,他只是在“工作区”的末尾添加了一个“2”。

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

这就创建了一个新的文件夹:“workspace2”。Eclipse运行良好;从那以后,我就再也没有任何锁定的问题了。

#17


0  

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

它将发生在您没有关闭eclipse时。exe正确。

*Open Task manager->End task your eclipse->Now open eclipse.exe it will work.

*打开任务管理器->结束任务您的eclipse->现在打开eclipse。exe将工作。

Hope its help someone.

希望它帮助别人。

#18


0  

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

我曾经观察过一个例子,当eclipse在强制退出时,或者在linux中使用Alt-f2 xdie时,试图立即打开eclipse就会显示错误。甚至metadat /。这种情况下不存在锁文件。然而,它在大约两分钟后开始工作。

#1


490  

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

只需删除eclipse工作区目录中的.metadata目录中的.lock文件。

Precaution - If you delete the .metadata folder all preference will be deleted.

预防——如果您删除了.metadata文件夹,所有的首选项将被删除。

#2


36  

I've seen 3 other fixes so far:

到目前为止,我已经看到了其他3个补丁:

  1. in .metadata/, rm .lock file
  2. 在.metadata/, rm .lock文件中。
  3. if #1 doesn't work, try killing the process javaw.exe etc. then rm .lock file
  4. 如果#1不起作用,尝试杀死进程javaw。exe等,然后是rm .lock文件。
  5. if #1 and #2 don't work, try rm .log file in .metadata/, and double check .plugin/.
  6. 如果#1和#2不起作用,请在.metadata/和double check .plugin/中尝试rm .log文件。
  7. This has always worked for me: relocate .metadata/, open and close eclipse, then overwrite .metadata back
  8. 这对我来说一直很有效:重新定位。元数据/,打开和关闭eclipse,然后覆盖。元数据。

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

解决方案归结为清理.metadata文件夹。

#3


12  

Go to TaskManager(Right Click in the Task Bar) and select Processess menu bar and select eclipse.exe and Click EndProcess

转到TaskManager(在任务栏右击)并选择Processess菜单栏并选择eclipse。exe并单击EndProcess

#4


11  

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.

在我的例子中,工作空间的实际位置发生了变化,但是我使用了一个符号链接,使它看起来像是在同一个位置。我在日志中看到了错误,表明eclipse正在查看以前的“真实”位置,而不是遵循符号链接,这导致了错误。

In my case, I just moved the workspace back to its old location.

在我的例子中,我只是将工作空间移回原来的位置。

#5


7  

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.

还有另一种情况,即工作区的路径可能不存在,例如,如果您从另一个工作区导入了首选项,那么一些导入的工作区地址可能出现在您的“open workspace”对话框中;如果你不注意这些地址,一旦你试图打开它们,你会得到同样的错误。

#6


7  

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.

在管理员模式下运行eclipse为我修复了它。您可以通过[右击]->作为管理员在eclipse上运行。从您的安装目录删除。

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.

我在一个工作环境中,win7机器有限制性的权限。我也删除了.lock和.log文件,但这并没有帮助。它可以是所有的结合,使它起作用。

#7


2  

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.

有时,如果您在Windows上,您可能不会看到所有的进程——或者任务管理器中的罪魁祸首进程。我必须点击“来自所有用户的显示流程”,还有这个java。为了找回我的工作空间,我不得不杀了他。

#8


2  

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.

如果没有工作,另一个可能的情况是看到有一个正在运行的Java应用程序。可能是您之前的打开和关闭已经留下了未被杀死的java实例。

  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.

    如果有两个至少需要杀死一个java实例,那么要查找任何java实例。但是,大多数情况下,我要杀死任何java运行:),因为java使用的是早期的工作空间,如果不杀死它,它仍然会使用。

  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.

    如果您想要使用多个IDE来使用和处理不同的项目,那么需要更改另一个工作空间,但是在打开IDE之后,您应该导入项目表单工作区。

#9


1  

deleting logs and .lock didn't work but

删除日志和。lock没有工作,但是。

-clean option fixed it for me.

-clean选项帮我搞定。

#10


1  

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.

当eclipse没有关闭时,我就遇到了这个问题(kill eclipse process从任务管理器或计算机电源关闭),我尝试了下面的步骤,它为我工作。

1) Remove the file names start with ".fileTable" from this folder

1)删除文件名以“开始”。从这个文件夹文件表”

C:\eclipse\configuration\org.eclipse.osgi.manager

C:\ eclipse \ \ org.eclipse.osgi.manager配置

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

2)删除像文本文件这样的日志文件,从这个文件夹开始使用数字名称。

C:\eclipse\configuration

C:\ eclipse \配置

3) Open Command prompt(cmd) navigate to this folder

3)打开命令提示符(cmd)导航到该文件夹。

C:\eclipse

C:\ eclipse

type below command

输入下面的命令

eclipse clean start

eclipse干净的开始

Eclipse说:“使用中的工作区或不能创建的工作区,选择了不同的工作区。“如何解锁工作空间?”

#11


0  

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.

@Boris给出的答案在99%的时间里都是正确的,但是如果您在旧版本的Eclipse中打开工作空间,它也会发生。当在Galileo中打开时,一个与Juno一起导入/创建的工作区会抛出这个错误。

#12


0  

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.

另一个非常常见的原因是,如果您试图加载一个已不再连接的驱动器上的目录。例如,在C:\Code\Java中编写程序,但偶尔会在闪存驱动器上工作,H:\Code\Java。如果您没有驱动器连接,那么很容易相信您正在尝试加载一个有效的目录,而不注意您的输入错误。

#13


0  

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.

另一个问题是,当eclipse没有对您的src文件夹进行写访问时。更改安全权限并确保“经过身份验证的用户”被添加到所有权限检查但完全控制和特殊权限。

#14


0  

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.

在我重新启动系统(经过很长时间之后)之后,我有了这个错误。通常我只是让它睡觉)。发现一旦我安装了驱动器(通过点击和打开它),项目文件夹所在的位置,并重新启动eclipse,解决了我的问题。

PS: I'm an ubuntu user.

PS:我是ubuntu用户。

#15


0  

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

这里有几个步骤可以解决这个问题。4步对我来说是有效的。

  1. Delete .log files along .metadata folder.
  2. 删除.log文件沿着.metadata文件夹。
  3. Check the current user permission make sure to check the full control checkbox click apply then OK.
  4. 检查当前的用户权限,确保检查完整的控制复选框,点击应用即可。
  5. 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.
  6. 如果您在运行eclipse编辑器之前运行系统驱动器碎片整理或维护,那么在您的驱动程序的系统维护之前,有时原始的文件路径并不在它们各自的路径中,以确保在eclipse工作台或类似的东西被保存之前运行“以前版本”。
  7. 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.
  8. 最后一个选项对我有效。检查当前驱动器的驱动器号,代码编辑器保存在那里。如果有什么不寻常的e。在你的维修之前,你的驱动器号是K,然后是碎片整理或维护。驱动器现在L因此你应该改变驱动器到原来一个k .单击ff:打开控制面板系统和安全管理工具计算机管理磁盘管理磁盘mngt选择驱动的例子L然后右键>更改驱动器号和路径>点击删除>然后好,再次打开它然后>单击add >选择你的原始驱动器,然后单击ok。如果你用你的电脑很长一段时间,首先要重新启动来刷新所有东西。

#16


0  

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).

我一直在运行Eclipse作为管理员(sudo Eclipse从命令行),因为“workspace”文件夹正在使用或不能创建…错误(并且作为管理员运行,这似乎是唯一的解决方案)。

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".

一位同事(和我一起处理这个问题)想通过点击图标来运行Eclipse。因此,当他运行Eclipse时,对话框会选择您的工作区,他只是在“工作区”的末尾添加了一个“2”。

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

这就创建了一个新的文件夹:“workspace2”。Eclipse运行良好;从那以后,我就再也没有任何锁定的问题了。

#17


0  

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

它将发生在您没有关闭eclipse时。exe正确。

*Open Task manager->End task your eclipse->Now open eclipse.exe it will work.

*打开任务管理器->结束任务您的eclipse->现在打开eclipse。exe将工作。

Hope its help someone.

希望它帮助别人。

#18


0  

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

我曾经观察过一个例子,当eclipse在强制退出时,或者在linux中使用Alt-f2 xdie时,试图立即打开eclipse就会显示错误。甚至metadat /。这种情况下不存在锁文件。然而,它在大约两分钟后开始工作。