1. 程式人生 > >Ubuntu16.04 建立eclipse快捷方式和顯示eclipse選單欄

Ubuntu16.04 建立eclipse快捷方式和顯示eclipse選單欄

一、建立快捷方式

注意:儘量只打開一個命令終端
1.UBuntu的選單圖示儲存在/usr/share/applications目錄下,所以先在該目錄下建一個eclipse.desktop檔案(sudo的作用,避免許可權限制)

sudo gedit /usr/share/applications/eclipse.desktop
2.在檔案中輸入以下內容(注意每段末沒有空格)

[Desktop Entry]
Encoding=UTF-8
Name=Eclipse Platfrom
Comment=Eclipse IDE
Exec=/opt/eclipse/eclipse
Icon=/opt/eclipse/icon.xpm
Terminal=false
StartupNotify=true
Type=Application
按Ese鍵後,:wq儲存退出,現在就能在/usr/share/applications目錄下找到該快捷方式圖示:
在這裡插入圖片描述

最後把圖示檔案複製到桌面即可。

二、開啟eclipse沒有選單欄

方法1:

1,、在eclipse安裝目錄下新建一個eclipse.sh,其內容如下:

export UBUNTU_MENUPROXY=0 
/opt/eclipse/eclipse 

第二行是指項eclipse安裝目錄裡的eclipse啟動器。
將eclipse.sh檔案屬性設定為可執行。
2、回到桌面建立一個eclipse.desktop,內容如下:

[Desktop Entry] 
Name=Eclipse 
Type=Application 
Exec=/opt/eclipse/eclipse.sh 
Terminal=false 
Icon=/opt/eclipse/icon.xpm 
Comment=Integrated Development Environment 
NoDisplay=false 
Categories=Development;IDE; 
Name[en]=Eclipse 

其中Exec指向剛建立的sh指令碼,Icon指向eclipse安裝目錄下的圖示。
將eclipse.desktop檔案屬性設定為可執行。

方法2:

把之前/usr/share/applications/eclipse.desktop修改為:

[Desktop Entry]
Encoding=UTF-8
Name=Eclipse Platfrom
Comment=Eclipse IDE
Exec=/opt/eclipse/eclipse
Icon=/opt/eclipse/icon.xpm
Terminal=false
StartupNotify=true
Type=Application
Categories=Application;Development;