Noobie approach for Java

Noobie approach for Java

Java programming language was originally developed by Sun MicroSystem led by James Gosling. After that it was acquired by Oracle.

Java is Objected Oriented, Platform Independent, Secure, Portable, Robust, Multithread, Dynamic, Distributed.

Let us get into the hierarchy of Java .


Java Development Kit (JDK): Java Development Kit contains two parts. One part contains the utilities like javac, debugger, jarwhich helps in compiling the source code (.java files) into byte code (.class files) and debug the programs. The other part is the JRE, which contains the utilities like java which help in running/executing the byte code. If we want to write programs and run them, then we need the JDK installed.

javac: javac tool reads class and interface definitions written in the java programming language and compiles them to byte code.

javap : javap disassembles a class file. it displays information about fields, constructors and methods present in a class file.

Java Run-time Environment (JRE):Java Run-time Environment helps in running the programs. JRE contains the JVM, the java classes/packages and the run-time libraries. If we do not want to write programs, but only execute the programs written by others, then JRE alone will be sufficient.

Java Virtual Machine (JVM):Java Virtual Machine is important part of the JRE, which actually runs the programs (.class files), it uses the java class libraries and the run-time libraries to execute those programs. Every operating system(OS) or platform will have a different JVM.

java : java command is used to run a java program and opens a new command prompt.It internally calls JVM of running programs.

javaw : javaw command is same as java but doesnt open a new window of command prompt.

Just In Time Compiler: JIT is a module inside the JVM which helps in compiling certain parts of byte code into the machine code for higher performance. Note that only certain parts of byte code will be compiled to the machine code, the other parts are usually interpreted and executed.

Java is guaranteed to be Write Once, Run Anywhere.Java Programs are not compiled into executable files instead they are compiled into bytecode, which the JVM then executes at the runtime. Java Source code is compiled into bytecode using javac compiler. the bytecode gets save on the disk with the extension .class. When the program is to be run, the byte code is converted, using the just-in-time compiler(JIT). The result is machine code which is fed to the memory and is executed.


      Flow of Java Program