今天準備在Ubuntu下搭建Eclipse開發環境,下載好相應的軟件並解壓到相應的目錄。在啓動時卻出現以下錯誤:java
查看命令行日誌,(使用命令行啓動便可看到相應的信息):算法
[plain] view plain copyapp
An exception occurred while writing to the platform log: dom
java.lang.NullPointerException eclipse
at org.eclipse.equinox.launcher.Main.openLogFile(Main.java:2559) 編輯器
at org.eclipse.equinox.launcher.Main.log(Main.java:2392) ide
at org.eclipse.equinox.launcher.Main.run(Main.java:1461) ui
at org.eclipse.equinox.launcher.Main.main(Main.java:1426) spa
Logging to the console instead. .net
!ENTRY org.eclipse.equinox.launcher 4 0 2014-06-01 00:30:05.824
!MESSAGE Exception launching the Eclipse Platform:
An exception occurred while writing to the platform log:
java.lang.NullPointerException
at org.eclipse.equinox.launcher.Main.openLogFile(Main.java:2559)
at org.eclipse.equinox.launcher.Main.log(Main.java:2392)
at org.eclipse.equinox.launcher.Main.run(Main.java:1462)
at org.eclipse.equinox.launcher.Main.main(Main.java:1426)
Logging to the console instead.
!STACK
java.lang.InternalError: internal error: SHA-1 not available.
at sun.security.provider.SecureRandom.init(SecureRandom.java:99)
at sun.security.provider.SecureRandom.<init>(SecureRandom.java:78)
at java.security.SecureRandom.getDefaultPRNG(SecureRandom.java:192)
at java.security.SecureRandom.<init>(SecureRandom.java:156)
at java.io.File$TempDirectory.<clinit>(File.java:1901)
at java.io.File.createTempFile(File.java:2010)
at org.eclipse.equinox.launcher.Main.canWrite(Main.java:1312)
at org.eclipse.equinox.launcher.Main.computeDefaultConfigurationLocation(Main.java:1294)
at org.eclipse.equinox.launcher.Main.getConfigurationLocation(Main.java:1738)
at org.eclipse.equinox.launcher.Main.processConfiguration(Main.java:1796)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:563)
at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
at org.eclipse.equinox.launcher.Main.main(Main.java:1426)
Caused by: java.security.NoSuchAlgorithmException: SHA MessageDigest not available
at sun.security.jca.GetInstance.getInstance(GetInstance.java:159)
at java.security.Security.getImpl(Security.java:695)
at java.security.MessageDigest.getInstance(MessageDigest.java:159)
at sun.security.provider.SecureRandom.init(SecureRandom.java:97)
... 12 more
提示,SHA-1這個算法沒法找到,但這個是jdk系統提供的一個算法。包含在JAVA_HOME/jre/lib/jsse.jar中。
打開想要的目錄查看,結果只有一個jsse.pack,而沒有jsse.jar。 這也是異常拋出的緣由了,使用unpack200進行對應jar包的解壓。
[plain] view plain copy
unpack200 jsse.pack jsse.jar
若是提示:Error: Could not open jar file:jsse.jar
則表示當前用戶對該目錄的文件沒有寫的權限,使用root便可。
[plain] view plain copy
su root
而後輸入root的密碼,在執行unpack命令便可。此時在命令行中使用root身份便可啓動Eclipse。
可是,在Eclipse目錄下,雙擊eclipse的圖標,或者是不在root身份運行則提示錯誤:permission denied.
那麼如何在圖形界面上讓eclipse使用root身份運行呢?
首先咱們須要建立一個eclipse的快捷啓動方式,好比這裏咱們建立到桌面:
[plain] view plain copy
sudo gedit /home/gavin/Desktop/eclipse.desktop
而後在打開的編輯器裏輸入:
[plain] view plain copy
[Desktop Entry]
Categories=Development;
Comment[zh_CN]=
Comment=
Exec=/path/to/eclipse/eclipse
GenericName[zh_CN]=IDE
GenericName=IDE
Icon=/path/to/eclipse/icon.xpm
MimeType=
Name[zh_CN]=eclipse
Name=eclipse
Path=
StartupNotify=true
Terminal=false
Type=Application
這樣咱們就建立了一個eclipse的快捷方式,注意啓動的/path/to/eclipse換成你的eclipse路徑便可。
可是這樣仍是沒法啓動,由於仍是以普通方式啓動的,接下來,咱們須要使用gksu命令,
首先安裝gksu:
[plain] view plain copy
sudo apt-get install gksu
而後再次編輯eclipse.desktop,將啓動的Exec後面的命令加上gksu,
[plain] view plain copy
Exec=gksu /path/to/eclipse/eclipse
保存,而後雙擊快捷方式,則彈出root密碼的輸入,輸入後方可啓動eclipse。
若是出現Untrusted application launcher, 可以使用chmod +x /path/to/eclipse.desktop便可