Difference between Java and Javax

Key difference: Java is a programming language, which has been influenced by the C language. Java and Javax are essentially packages that are used with the context of the Java programming language. Practically there is no difference between Java and Javax. It is just the name that differs.

Java is a programming language, which has been influenced by the C language. It derives much of its syntax from C and C++, however it has fewer low-level facilities than either. Java is a general-purpose programming language that is designed to have fewer implementation dependencies as compared to previous languages. It is concurrent, class-based, and an object-oriented language.

Java was developed by James Gosling at Sun Microsystems and was released in 1995. It was originally released as a core component of Sun Microsystems' Java platform.

Java is designed to allow the same code to run on various platforms. i.e., developers are allowed to “write once, run anywhere” (WORA). Hence, Java applications are typically compiled to bytecode. A class file which contains a Java bytecode can then be run on any Java Virtual Machine (JVM). This would be regardless of computer architecture.

Java and Javax are essentially packages that are used with the context of the Java programming language. The command to bring up a java package is import java, while the command to bring up a javax package is import javax. For example: import java.util.*; or import javax.util.*;

Originally, everything that was part of the standard API was part of the java package, whereas everything that was not part of the standard API was released under the package name javax. Hence, packages essential to the API was java, while javax contained the extensions to the API. It can even be said that javax, is just java with an x, which stands for extension.

Over time the extensions that were released as javax, become integral to the Java API. However, moving the extension from the javax package to the java package would be too cumbersome and would end up breaking a bunch of existing code. Hence, eventually it was decided that the javax packages would become part of the standard API.

So, practically there is no difference between Java and Javax. It is all in a name.

Image Courtesy: livehacking.com

Most Searched in Pregnancy and Parenting Most Searched in Electronics
Most Searched in Education and References Most Searched in Cars and Transportation
Rat vs Mouse
Alcatel One Touch Idol Ultra vs Nokia Lumia 720
Post vs Page
Rajya Sabha vs Vidhan Sabha vs Lok Sabha

Comments

vvv nice info thank u

Thanks

Hi, thanks for such a nice article. i have a question regarding javax package. recently, i have encountered a class not found exception saying: java-lang-nosuchmethoderror-javax.ws.rs.core.Response.readEntity(Ljava/lang/class). i have compiled the code with java version 1.7.79 (windows eclipse)and running on java 1.7.80(linux). what can be the reason?

Hi, The reason is that classes with the javax.ws package prefix are not available in a standard Java installation. You have to use an extension that provides the WS APIs, such as a CXF SOAP library or a Java EE runtime. This is where the article got it wrong - there is one important difference between java and javax - while all classes under the java prefix are always available, only some classes under the javax package are always available. For other classes under the javax package, you would need an extension - either a library or a runtime that provides them on top of standard Java runtime. The original difference between java and javax was that javax classes were to be provided by additional extensions to standard Java. Since then, some of the javax classes, like JAXB (package javax.xml.bind) which was initially only available in Java EE, were accepted into the standard Java. But even now, many javax classes are still not yet part of standard Java. A typical runtime that provides many javax classes is a Java EE runtime. This is a special edition of Java (typically a Java EE application server) which runs above standard Java SE and provides a lot of extensions.

Thanks!

Thanks

Add new comment

Plain text

CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.