The java.*, javax.* and org.* packages documented in the Java Platform Standard Edition API specification make up the Offi Cial, supported, public interface. If a Java program directly calls only API in these packages, it'll operate on all java-compatible platforms, regardless of the underlying OS platform.
The sun.* packages is not part of the supported, public interface. A Java Program This directly calls into sun.* packages are not guaranteed to work on all java-compatible platforms. In fact, such a program was not guaranteed to work even in the future versions on the same platform.
Each company, that implements the Java platform would do so in their own private. The classes in sun.* is present in the JDK to support Oracle's implementation of the Java platform:the sun.* classes are What does the Java platform classes work "under the covers" for Oracle's JDK. These classes won't in general be present on another vendor ' s Java platform. If your Java program asks for a class ' Sun.package.Foo ' by name, it may fail with classnotfounderror, and you'll have the LO St A major advantage of developing in Java.
Technically, nothing prevents your program from calling to Sun.* by name. From one release to another, these classes is removed, or they may is moved from the one package to another, and it ' s fair Ly likely that their interface (method names and signatures) would change. (from Oracle's point of view, since we is committed to maintaining the Java platform, we need to is able to change sun.* To refine and enhance the platform.) In this case, even if is willing to run only on Oracle's implementation, you run the risk of a new version of the Imp Lementation breaking your program.
In general, writing Java programs This rely on sun.* was risky:those classes is not portable, and was not supported.
Http://www.oracle.com/technetwork/java/faq-sun-packages-142232.html
Reprint: Why developers should not Write Programs that call ' Sun ' Packages