为什么我得到包javax.crypto不存在 [英] Why am I getting package javax.crypto does not exist
问题描述
当我使用javax.crypto.Mac编译一个类时,我收到此错误消息?
When I compile a class using javax.crypto.Mac I get this error message?
包javax.crypto不存在
package javax.crypto does not exist
我可以通过在编译类路径中包含jre / lib / jce.jar来修复它。
I can fix it by including jre/lib/jce.jar in my compile classpath.
为什么jce.jar不在默认的jdk类路径上? jre / lib / rt.jar在classpath上,包含其他javax包,但是jce看起来很特别?
Why is jce.jar not on the default jdk classpath? jre/lib/rt.jar is on the classpath, and includes other javax packages, but jce seems special?
推荐答案
好吧,这对我来说是个错误。我用来编译代码的Ant文件在 javac
任务上有这个属性:
OK, this was a mistake on my part. The Ant file I was using to compile the code had this attribute on the javac
task:
bootclasspath="${java.home}/lib/rt.jar"
卫生署。您可以像这样添加JCE jar:
Doh. You can add the JCE jar like this:
bootclasspath="${java.home}/lib/rt.jar:${java.home}/lib/jce.jar"
这篇关于为什么我得到包javax.crypto不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!