Java is a powerful general-purpose programming language that has been around for over 24 years now since its inception in 1996. The Java Programming environment consists of —
- Java Language — used by programmers to write the application
- The Java Virtual Machine (JVM) — used to execute the application
- The Java Ecosystem — provides additional value to the developers using the programming language
What is the Java Language?
- It is a human-readable language which is generally considered easy to read and write (albeit a bit verbose at times).
- It is class-based and object-oriented in nature.
- Java is intended to be easy to learn and to teach.
- There are many different implementations of Java available, both proprietary and open source.
- The Java Language Specification (JLS) defines how a confirming Java application must behave.
What is the JVM?
The Java Virtual Machine is a program which provides the runtime environment to execute Java programs. Java programs cannot run if a supporting JVM is not available.
On running a Java program from the command line like —
java <arguments> <program name>
the OS would bring up the JVM as a process and then execute the program in the freshly started (and empty) Virtual Machine.
Fun Fact: The Sun JVM is written in C (mostly).
JVM does not take Java source files as input. The java source code is first converted to bytecode by javac program. Javac takes in source files as input and outputs bytecode in the form of class files with .class extension.
These class files are then interpreted (stepped through one at a time) by the JVM interpreter and the program is executed.
JVM makes the programmer’s life easier by-
- providing a container for the Java program to run in
- creating a secure execution environment as compared to C/C++
- taking memory management out of the hands of the developer
- allowing class files from one platform to run on a different environment without any modification or recompilation
This property is known as “write once, run anywhere” (WORA) and thus make Java an easily portable language.
Another important aspect of JVM is the Just-in-Time (JIT) compiler. Researches done is the 1970’s and 1980’s revealed that the runtime behavior of programs has some interesting patterns. There are some portions of code which are executed far more often than other.
Java was the first language to make use of this runtime information and the HotSpot JVM (first launched in Java 1.3 by Sun) identifies the “hot methods” (frequently called) and the JIT compiler converts them directly into machine code bypassing the conversion of source code into bytecode.
This runtime instrumentation by Java significantly increases Java’s performance even surpassing that of compiled C and C++ code in some cases.
JVM too has many implementations available, just like Java language itself. JVM Specification defines the behavior of a properly functioning JVM.
The Java Ecosystem
Java has emerged to be a robust, portable and high performing language and has been widely adopted globally. One of the major reasons for the success of Java is the immense number of third party libraries and components written in Java.
Today it is rare to a find a component which does not have a supporting Java connector. From traditional MySQL to NoSQL, monitoring frameworks, network components all have a Java connector readily available.
Source: The Java Programming Environment
Top comments (0)