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

wlaem picture wlaem · Dec 4, 2012 · Viewed 12.8k times · Source

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?

Answer

Tom G picture Tom G · Dec 4, 2012

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