Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

javax vs java package

Tags:

java

What's the rationale behind the javax package? What goes into java and what into javax?

I know a lot of enterprise-y packages are in javax, but so is Swing, the new date and time api (JSR-310) and other J2SE packages.

like image 838
Jaka Jančar Avatar asked Apr 07 '09 22:04

Jaka Jančar


People also ask

What is javax package in Java?

The javax prefix is used by the Java programming language for a package of standard Java extensions. These include extensions such as javax. servlet, which deals with running servlets, and javax. jcr, which deals with the Java content library. Package, Programming terms.

What is package and import in Java?

A package in Java is used to group related classes. Think of it as a folder in a file directory. We use packages to avoid name conflicts, and to write a better maintainable code. Packages are divided into two categories: Built-in Packages (packages from the Java API)


1 Answers

Originally javax was intended to be for extensions, and sometimes things would be promoted out of javax into java.

One issue was Netscape (and probably IE) limiting classes that could be in the java package.

When Swing was set to "graduate" to java from javax there was sort of a mini-blow up because people realized that they would have to modify all of their imports. Given that backwards compatibility is one of the primary goals of Java they changed their mind.

At that point in time, at least for the community (maybe not for Sun) the whole point of javax was lost. So now we have some things in javax that probably should be in java... but aside from the people that chose the package names I don't know if anyone can figure out what the rationale is on a case-by-case basis.

like image 177
TofuBeer Avatar answered Oct 13 '22 17:10

TofuBeer