Linux 環境中普通使用者啟動Myeclipse出錯

Amei1314發表於2016-08-14

  將Myeclipse安裝在/usr/local/myeclipse目錄中,由root使用者啟動時沒有問題,而用普通使用者時出現如下故障:

The configuration area at '/usr/local/myeclipse/configuration' is not writable.  Please choose a writable location using the '-configuration' command line option.

意思就是/usr/local/myeclipse/configuration對於普通使用者來說是不可寫的,當讓可以將/usr 及其所有的子目錄都變成 777的許可權,但是畢竟不安全。在這句話的後邊提示可以通過配置 -configuration引數來改變configuration目錄的位置。 我們希望當每個使用者啟動myeclipse的時候都有自己的配置目錄,因此可以通過一個簡單指令碼實現以下。

指令碼名就為myeclipse,可以直接通過這個指令碼來對myeclipse進行配置,然後啟動myeclipse。

#!/bin/bash

if [ "$USER" == "root" ]; then
  workpath=/root/myeclipse
else
  workpath=/home/$USER/myeclipse
fi

if [ ! -d "$workpath" ]; then
  mkdir -p $workpath
fi

/usr/local/myeclipse/myeclipse -configuration $workpath

將此myeclipse指令碼放在/usr/local/bin目錄中,這樣任何使用者都可以呼叫,並且,每個使用者都有自己的配置目錄。

相關文章