启用 java 安全性(Java 加密扩展 - JCE)后 Eclipse 崩溃

Eclipse is crashing after enabling java security (Java Cryptography Extension - JCE)

Eclipse 在启用 java 安全性后崩溃。我已将 local_policy.jar 和 US_export_policy.jar 添加到 jre/lib/security 文件夹中。

我从下面得到文件 link :

Java 加密扩展 (JCE) 无限强度管辖策略文件 7 :http://www.oracle.com/technetwork/java/javase/downloads/jce-7-download-432124.html

Debug options:
file:/Users/jkuria/soft/eclipse_downloads/eclipse 2/Eclipse.app/Contents/MacOS/.options not found
org.osgi.framework.BundleException: Error initializing container.
at org.eclipse.osgi.container.SystemModule.init(SystemModule.java:93)
at org.eclipse.osgi.internal.framework.EquinoxBundle$SystemBundle.init(EquinoxBundle.java:209)
at org.eclipse.osgi.internal.framework.EquinoxBundle$SystemBundle.init(EquinoxBundle.java:201)
at org.eclipse.osgi.launch.Equinox.init(Equinox.java:168)
at org.eclipse.core.runtime.adaptor.EclipseStarter.startup(EclipseStarter.java:296)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:231)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
Caused by: java.lang.ExceptionInInitializerError
at org.eclipse.osgi.internal.framework.EquinoxBundle$SystemBundle$EquinoxSystemModule.initWorker(EquinoxBundle.java:137)
at org.eclipse.osgi.container.SystemModule.init(SystemModule.java:83)
... 12 more
Caused by: java.security.ProviderException: setSeed() failed
at sun.security.provider.NativePRNG$RandomIO.implSetSeed(NativePRNG.java:458)
at sun.security.provider.NativePRNG$RandomIO.access0(NativePRNG.java:329)
at sun.security.provider.NativePRNG.engineSetSeed(NativePRNG.java:212)
at java.security.SecureRandom.getDefaultPRNG(SecureRandom.java:209)
at java.security.SecureRandom.<init>(SecureRandom.java:190)
at org.eclipse.osgi.internal.framework.UniversalUniqueIdentifier.computeNodeAddress(UniversalUniqueIdentifier.java:127)
at org.eclipse.osgi.internal.framework.UniversalUniqueIdentifier.<clinit>(UniversalUniqueIdentifier.java:35)
... 14 more
Caused by: java.io.IOException: Operation not permitted
at java.io.FileOutputStream.writeBytes(Native Method)
at java.io.FileOutputStream.write(FileOutputStream.java:313)
at sun.security.provider.NativePRNG$RandomIO.implSetSeed(NativePRNG.java:456)

您应该将以下内容添加到 eclipse.ini

vmargs 部分
-Djava.security.egd=/dev/random

使用 /dev/random 可能会导致 Java 应用程序启动延迟,因为 /dev/random 会阻塞,直到生成大量熵。

一般来说,/dev/urandom 将是一个性能更高且同样安全的随机源。由于 Java 特性,vmarg 实际上看起来像:

-Djava.security.egd=file:/dev/./urandom

但是,我不清楚为什么需要这个 属性。接受的答案有效,但没有说明原因。我很想知道异常的原因。