Friday, September 16, 2016

Basics of JAVA

Welcome to Java!

Java is high level, modern programming language designed in early 1990's by Sun Microsystem, and currently owned by Oracle.

The feature of Java that I like most is Platform Independent i.e. Write Once, Run Anywhere.
Image result for features of java
More than 3 billion devices run on Java.

Lets suppose someone transfers a file on my laptop with name MyFirstJavaProgram.java(all files with java program written in it has .java extension and is also called source code) and ask me to run on my computer.

Now to run this code on my system, I need few things.

1. Java Development Kit(JDK)
It includes java compiler(javac), java debugging tool(jdb) and java archiving tool(jar).

2. Java Runtime Environment (JRE)
It includes Java Virtual Machine(JVM) and Integrated Development Environment(IDE)
IDE Example - Eclipse

Now you need to set java environment variable path. For this please go through the video with the link below.

https://www.youtube.com/watch?v=oowsJcJLmss

Once the path is set you are ready to run the given code.

What exactly happens?

When you run your .java source code, the java compiler compiles the code and transforms it into bytecode. The file that consists of this bytecode has .class extension.

Now this .class file goes on to JVM(Java Virtual Machine) for execution. Once executed, JVM transforms this bytecode into machine language which our machine understands. The machine language that is created completely depends on your machine(Processor) and its Operating System(Windows, Linux, ..) with which JVM is interacting(that is why it is Platform Dependent, Write Once, Run Anywhere).
 
For an application which consists of multiple java programs, multiple files get created with .class extension. All these files are collected in a single file. This single file is then compressed to easily distribute it over web network to run the application over web. This compressed file has extension .jar(java archive).

In my next blog we will write a simple java program and I will give you some key insights about it. Do follow my blog as it will boost up my morale to write more tutorials. 

No comments:

Post a Comment