如題,由於要學習hadoop,所以我在我的ubuntu裡建立了一個使用者user2專門用於安裝hadoop環境,原來的使用者是user1,原來user1使用者已經安裝了eclipse,所以我想在user2使用者登入後,能夠直接使用uesr1使用者安裝的eclipse,而不用重新安裝了。實現方法就是使用user2使用者身份登入系統後,進入user1使用者安裝eclipse的目錄,我的目錄是/home/m/.java/eclipse,在這裡有一個檔案夾叫configuration,我們只需將這個檔案夾的許可權修改為777即可實現共用。
chmod 777 configuration/
這樣,user2就可以使用eclipse了。
但是,當我再次使用user1身份登入後,開啟eclipse時,出現了錯誤:
Locking is not possible in the directory "/home/m/.java/eclipse/configuration/org.eclipse.osgi". A common reason is that the file system or Runtime Environment does not support file locking for that location. Please choose a different location, or disable
file locking passing "-Dosgi.locking=none" as a VM argument.
/home/m/.java/eclipse/configuration/org.eclipse.osgi/.manager/.fileTableLock (\u6743\Uffffffff
在網上搜尋了一下這個問題,找到的是:
Cause
The error occurs when the user does not have the required permission to access the .fileTableLock file. This file is in the configuration directory for Installation Manager.
The permission is not available because the umask settings for the previous user who ran Installation Manager were not set for group mode. The umask settings for the previous user did not allow files created in group mode to have group permissions equal to
owner permissions.
The configuration folder is used to store OSGi cache information. The.fileTableLock file is accessed by the OSGi cache at runtime. Failing to access the .fileTableLock file
can impact OSGi cache internal logic.
大意是因為user2使用了eclipse之後,user1就不再擁有操作“檔案表鎖檔案”的許可權了,需要重新設定許可權。解決方案如下:
Resolving the problem
To resolve this issue, take one of the following steps:
- Change the permission for
.fileTableLock file to 777
- There are several directories that have .fileTableLock files that might require a change of permissions:
{IM_HOME}/eclipse/configuration/org.eclipse.core.runtime/.manager
{IM_HOME}/eclipse/configuration/org.eclipse.equinox.app/.manager
{IM_HOME}/eclipse/configuration/org.eclipse.osgi/.manager
- Run this command on the configuration directory:
chmod -R g+rwx
- As a root user, change the owning group for the contents of the root directory of the Eclipse configuration directory to the group that uses Installation Manager in group mode:
chgrp -R <groupName> <{IM_HOME}/eclipse/configuration>
我首先將那三個檔案的許可權修改為777,命令如下:
cd org.eclipse.osgi/.manager/
sudo chmod 777 .*
cd org.eclipse.equinox.app/.manager/
sudo chmod 777 .*
cd org.eclipse.core.runtime/.manager/
sudo chmod 777 .*
然後在configuration這個目錄裡,我運行:
chmod -R g+rwx *.*
-R的意思是遇到檔案夾時遞迴更改。
這時,我在次開啟eclipse,原來的錯誤沒有了,但是又出現了,workspace這個目錄無法訪問的錯誤,
原因是我用user2登入後使用eclipse時把預設工程目錄給改了,user1和user2兩個使用者使用的工程目錄是不一樣的,如何才能每次開啟eclipse時都提示選擇workspace呢?
方法如下:
勾選圖中的選項,這樣每次開啟eclipse時,都會提示你選擇工作目錄了。方便兩個不同的使用者使用自己的工程目錄。
OK,希望對大家有所協助!