compile error after upgrading to Java 7: package sun.security.pkcs11 does not exist

java, pkcs#11, security

Solution

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

Problem

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?

Original source