The Java Environment - Overview

Contact Us or call 1-877-932-8228
The Java Environment - Overview

The Java Environment - Overview

A Java program is run differently than a traditional executable program.

Traditional programs are invoked through the operating system.

  • They occupy their own memory space.
  • They are tracked as an individual process by the OS.

Traditional programs are compiled from source code into a machine and OS-specific binary executable file.

  • To run the program in different environments, the source code would be compiled for that specific target environment.

When you run a Java program, the OS is actually running the Java Runtime Engine, or JRE, as an executable program; it processes your compiled code through the Java Virtual Machine (usually referred to as the JVM).

A Java source code file is compiled into a bytecode file.

  • You can consider bytecode as a sort of generic machine language.
  • The compiled bytecode is read by the JVM as a data file.
  • The JVM interprets the bytecode at runtime, performing a final mapping of bytecode to machine language for whatever platform it is running on.
  • Thus, Java programs are portable - they can be written in any environment, compiled in any environment, and run in any environment (as long as a JVM is available for that environment).
  • The JVM manages its own memory area and allocates it to your program as necessary.
  • Although this involves more steps at runtime, Java is still very efficient, much more so than completely interpreted languages like JavaScript, since the time-consuming parsing of the source code is done in advance.