Java | Environment

05 min read

Java is a most widely used and successful programming language. To run a java program, there is a need for setting up its environment called java environment. There are different java environments which will be seen below:

Java Developer's Kit (JDK):

Collection of tools used for developing and running java programs. There are 7 components of JDK:

  1. javac(java compiler) - compiles the java source code and creates the class file, which consists of bytecodes.
  2. java(java interpreter) - executes the class file by translating the byte codes.
  3. javap(java disassembler) - used to display public interfaces of a class file.  We can get both methods and variables of the public interfaces.
  4. jdb(java debugger) - helps to find the errors in the java program. It is a command line debugger and so it is not of much use as a GUI debugger.
  5. javah(java header file generator) - produces header files that enable the user to use native C or C++ code within a java class.
  6. javadoc(documentation) - helps to create documentation in the form of HTML files, from java source code files automatically.
  7. appletviewer - helps to run Java applets without actually using a Java-compatible browser.

JRE (Java Runtime Environment):

Java has been designed to work in a platform-independent manner. In order to achieve this dream concept of "write once and run anywhere(WORA)", we have the JRE running in the machine on top of the operating system. Every JRE is specific to a particular OS and the hardware used. JRE is available for a wide variety of hardware and software combinations, making java, a very portable language.

 

 

Java API:

Java standard library or API includes hundreds of classes and methods grouped into several functional packages. For Example, java.lang, java.io, java.net, java.applet, java.awt. The JRE contains set of core class libraries that are required for the execution of java programs. It also incorporates JVM which is an abstract machine. It can be implemented in software varying degree of hardware.

JVM (Java Virtual Machine) :

JVM is a virtual CPU that is simulated by a program to run on the actual CPU called native hardware.

 

The output of java compiler is bytecode which is machine independent. Bytecodes are highly optimized set of instructions designed to be executed by the Java Runtime System called JVM. Translating a java program into bytecode makes it much easier to run a program in a wide variety of environments. Only the JVM needs to be implemented for each platform.

The class loader loads the classes to be executed to the runtime data area and the execution engine executes the instructions in the given sequence, as per logic and produces the results.

POST A NEW COMMENT
     
  • Input (stdin)

    Output (stdout)


    Input (stdin)

    Your Output (stdout)

    Expected Output

    Compiler Message

    Input (stdin)

    2    3

    Your Output (stdout)

    5

    Expected Output

    5

    Compiler Message

    5

    Error