Search code examples
javadeprecatedsun

Usage of sun.* is discouraged


I'm actually developing a Java applet to access an HSM in order to sign data.

So I'm using a lot of Sun packages (PKCS11 wrapper and sunPKCS11 provider).

I saw that link : http://www.oracle.com/technetwork/java/faq-sun-packages-142232.html that tells us it is discouraged to use sun packages.

But I want to make sure why. I'm actually compiling my code in Java 1.6 x86 JDK.

Is it possible that end-users won't be able to use my application when updating their version of Java ? Or will the problem appear only if I change my JDK to compile my code ? Or is it both situations ?

Thanks in advance for your clarifications.


Solution

  • It's stated pretty clearly in the documentation your linked :

    A Java program that directly calls into sun.* packages is not guaranteed to work on all Java-compatible platforms. In fact, such a program is not guaranteed to work even in future versions on the same platform.

    So end-users might not be able to use your app if they're not using the same JDK as you.

    And yes, in the future you might have problems too with a newer version of your JDK.