今天准备在Ubuntu下搭建Eclipse开发环境,下载好相应的软件并解压到相应的目录。在启动时却出现如下错误:
查看命令行日志,(使用命令行启动即可看到相应的信息):
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
打开想要的目录查看,结果只有一个jsse.pack,而没有jsse.jar。 这也是异常抛出的原因了,使用unpack200进行对应jar包的解压。
unpack200 jsse.pack jsse.jar
则表示当前用户对该目录的文件没有写的权限,使用root即可。
su root
但是,在Eclipse目录下,双击eclipse的图标,或者是不在root身份运行则提示错误:permission denied.
那么如何在图形界面上让eclipse使用root身份运行呢?
首先我们需要创建一个eclipse的快捷启动方式,比如这里我们创建到桌面:
sudo gedit /home/gavin/Desktop/eclipse.desktop
[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:
sudo apt-get install gksu
Exec=gksu /path/to/eclipse/eclipse
如果出现Untrusted application launcher, 可使用chmod +x /path/to/eclipse.desktop即可