Reputation: 324
I just upgraded from Java 6 to Java 7 SDK and am now getting the following error in my ant build:
error: package sun.security.pkcs11 does not exist
Provider p = new sun.security.pkcs11.SunPKCS11(is);
I'm running Windows 7 64-bit. I can compile fine if I switch back to Java 6, but that is not an option any longer. I haven't had much luck finding a solution online. Anybody knows how to resolve this issue?
Upvotes: 8
Views: 15536
Reputation: 1729
I'm having the same error.
Only a type can be imported. sun.security.pkcs11.wrapper.CK_AES_CTR_PARAMS resolves to a package
I have windows 7 x64 with jdk 7x64 installed then replaced with jdk 7x32. I also made sure that my JAVA_HOME was set to the new jdk installation. I get the same problem when I run my application.
Upvotes: -2
Reputation: 4720
Since sunPKCS11 support is not there in Windows 64 bit, i am assuming that you are using windows 64 bit just for build environment and your runtime might be a linux or other supported environments.
If the above is true, then inorder to make the build work, copy the sunpkcs11.jar from a 32 bit jdk and copy to a 64 bit jdk under jre\lib\ext. This worked for me.
Or, alternatively wait for jdk8 where its fixed.
Upvotes: 2
Reputation: 193
The API has not been released by oracle oracle bug and the answers by tom and yassering are both corect.
Upvotes: 3
Reputation: 49
I have faced the same problem and i solve it by installing the 32-bit JDK insteade of 64-bit and sure it will work .
Upvotes: 3
Reputation: 12776
You will have to convert your application to use APIs which are not restricted. The compiler will warn you quite strictly when you have done such a thing -- this is the consequence of proceeding in the face of those warnings.
See Why Developers Should Not Write Programs That Call 'sun' Packages
Upvotes: 3