Eclipse 启动提示internal error:SHA-a not avaliable 和eclipse默认root启动
今天准备在Ubuntu下搭建Eclipse开发环境,下载好相应的软件并解压到相应的目录。在启动时却出现如下错误:
查看命令行日志,(使用命令行启动即可看到相应的信息):
[plain] view plain copy
-
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:1461)
-
at org.eclipse.equinox.launcher.Main.main(Main.java:1426)
-
Logging to the console instead.
-
!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即可