Understanding JDK, JRE and JVM | Java

Understanding JDK, JRE and JVM | Java

Basics • Java Fundamentals

At compile time Java file is compiled by Java compiler (doesn't interact with operating system) and convert the Java code into byte code.

At runtime following steps are performed

Bytecode

  • Byte code is a source code used to run on any platform.

  • Bytecode is an intermediate language between source code and host system.

  • It is a medium through which compiled Java code that interpreted on and hence it makes Java platform OS independent.

Java Architecture

  • It defines all the processes involved in creating Java program.

  • It is a collection of multiple components that is JDK, JRE & JVM.

  • It explains each and every step how every programme compiles and executed.

JVM (Java Virtual Machine)

  • It provides a platform independent way of executing codes.

  • JVM interprets the bytecode into the machine code depending upon the underlying operating system and hardware combination.

  • JVM reads bytecode.

  • Verify bytecode and link with library.

JRE (Java Runtime Environment)

  • It contains JVM and Java packages and classes i.e., Java library due to which it is called independent platform language.

  • A set of software tools which are used for developing Java applications.

  • Used to provide runtime environment.

  • It is implementation of JVM & use to provide runtime environment.

JDK (Java Development Kit)

It exist physically. It contains all tools needed to develop the Java program. A software development environment used to develop Java application & it contains JRE+ development tools.

Consist of -

javac:

  • It is compiler for the java program to compile java file.

  • Java compiler to which translate java source code Into bytecode that interpreter can understand.

Applet View:

  • It enables user to run Java applet.

  • It is a programme embedded in the work page to generate dynamic content.

java: The Java interpreter which interprets the byte code stored in the class and execute the programme would generate output.

javap: It is a dissembler which enable the user to convert bytecode file into programme description.

javah: It produces headphones to use native method.

jdb: Java debugger which helps user to find errors in the program.

javadoc: It creates HTML format documentation for Java source code file.

Decoding in Java

Programming is not just about writing program that work for you, it is also about how clean you write the code -

  • Clean code is easy to read and easy to test.

  • Can also be understood by other developers.

  • Classes and Methods are develop towards the fulfilment of task & not contaminated by secondary task.

  • Dependent on other code, which are limited to minimum.

  • No duplication

  • No surprise in code.

Characteristics of Clean Code

  • Simple: Should be made easy as possible.

  • Maintainable: Should be maintained in long run as many different developer can work on that class.

  • Testable: Should be easily testable & less prompt to error.

  • Readable: Should be easily readable.

Conclusion

The Java compilation process involves the Java compiler converting source code to bytecode at compile time. During runtime, the Java Virtual Machine (JVM) interprets bytecode, ensuring platform independence. Java architecture, comprising JDK, JRE, and JVM, facilitates code development and execution. Writing clean code is crucial for readability, maintainability, and testability, promoting effective collaboration among developers.

Did you find this article valuable?

Support Xander | ᓕᘏᗢ by becoming a sponsor. Any amount is appreciated!