错误:升级到 Java 1.6 后,com.sun.crypto.provider 包不存在
我最近将现有的java项目从java 1.4升级到1.6,但由于错误而无法编译:包com.sun.crypto.provider不存在。
我意识到我缺少一个库,但我不知道要下载哪个库或在哪里下载它?
I have recently upgraded an existing java project from java 1.4 to 1.6 and it fails to compile due to the error: package com.sun.crypto.provider does not exist.
I realise that I'm missing a library but I don't know which library to download or where to download it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
com.sun.crypto.provider
是 Sun Java 加密扩展 (JCE),为 Java 1.3 引入(我认为)是为了绕过美国政府疯狂的出口法规。不过,JCE 是非标准的(所有com.sun
包也是如此),并且它们在更高版本的 Java 中被重命名/重构,这些版本具有“适当的”加密包(javax.加密
)。因此,如果不进行修改(将 JCE 引用更改为新的标准包),您的应用程序将无法在 Java6 上运行。
com.sun.crypto.provider
is the Sun Java Cryptography Extension (JCE), introduced for Java 1.3 (I think) to get around the lunatic export regs of the US government. The JCE was non-standard, though (as are allcom.sun
packages), and they were renamed/refactored in later versions of Java, which have "proper" crypto packages (javax.crypto
).Therefore, your application as it stands will not run on Java6 without modification, changing the JCE referneces to the new standard packages.
您应该修改应用程序,使其不依赖于不属于公共 API 的库,而不是下载库。未来的升级不需要进一步的努力。
Rather than downloading a library, you should modify your application so that it doesn't depend on libraries that aren't part of the public API. Future upgrades would require no further effort.