Like javax contains the extensions, what is the com.sun package supposed to contain?
Like javax contains the extensions, what is the com.sun package supposed to contain?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It contains
SunOracle reference implementations of the standard Java (EE) APIs. Among others Mojarra (the reference JSF implementation of Oracle) and Glassfish (the reference Java EE implementation of Oracle) use this package. It’s preferable to not use those classes directly in your code as it would make your code tight coupled to the implementation. Coding against thejava(x)API directly enables you to change the implementation without changing your code (e.g. MyFaces instead of Mojarra and JBoss AS instead of Glassfish). Also JDK’s ownHttpServersits in thecom.sun.*package, see Simple HTTP server in Java using only Java SE API.Please note that the
com.sun.*package should not be confused withsun.*package which are the internal classes behind Oracle JRE which you should absolutely not import/use in your code as it would make your code tight coupled to the JRE make/version. Not usingsun.*package at all enables you to run your code on all other JRE implementations (OpenJDK, GCJ, etc).