{*Best*} Java Runtime Environment Basics and Details {#jre}

 Java Runtime Environment Basic‘Java’ means it is a programming language used by developers to create applications on your computer.Chances are you’ve downloaded a program that requires the Java runtime, and you can probably install it on your system. Java also allows you to run applications in your browser is a web plug-in.


1. How it Works Java?


runtime java


Computer programs are generally written in the human-readable source code. Compilers machine-readable (executable) programs to convert the source code. The production of a specific hardware implementation of the C ++ compilers to traditional programming languages, such as machine-readable code; For example, x86 hardware is compatible with the Intel x86 hardware running the Windows C ++ compiler executable programs, compiles the source code. A C ++ program using the platform-specific compiler needs to be recompiled for a different platform.


1.1 How Compiles the Java Program?


First of all, Java is a different approach than platform-specific compilers. Hardware-based bytecodes generated from the Java compiler, the source code. The bytecodes only the Java Virtual Machine (JVM) can run through. Java source code is compiled into class files, which is called the Java bytecode files.


Run java program


Class files in separate files with a specific format. They are machine-readable (executable) is not and can not be executed directly on the hardware. JVM bytecodes in a class file, understand and can run. Can understand that the job of the Java compiler and JVM will be run through a class file,and also changing the Java source code.


1.2 How to Run the Java Program?

Java bytecode files


In fact, the class files of the Java Virtual Machine to execute the instructions. JVM abstract computing machine. As a true computing machine, which has an instruction set. It is the Java class (bytecode) format can run the code.


At runtime, the class loader will be stored in the class file from the media or the network. Each class file to ensure that it is safe for the implementation of the class file is formatted correctly and is fed by a bytecode verifier. JVM byte verification process reduces the loading process of the class, but it only happens once every time the program runs. JVM classes from disk or network will be safe and then explains how to run the bytecodes.


Once the class is loaded (bytecodes available JVM), especially relevant JVM and are soft to the fact that the class file bytecodes. The JVM bytecode at runtime execution units (the interpreter or JIT) he was the one. Bytecodes execution units to carry out the instructions. The simplest is the standard implementation of the JVM interpreter. The bytecode associated with a function that reads and carries out the assessment. Interpreters are usually slow, native code compilers (like C ++ compiler), run at the time they need to search for the meaning of each bytecode. To speed up the implementation of the JVM is another execution unit. It JIT or “time” to the compiler. It not just compile it to native code prior to execution of a class file, runtime optimized bytecode.


1.3 JVM and Platform Independence


Java runtime environment and JVM runs in a Java class file, you will run across multiple platforms, the same Java code? Provided a platform-specific JVM for each platform. JVM for Windows, Linux, and Solaris platforms are available on Sun’s Web site. You can plug-in is a software processor to run on any hardware platform, such as a JVM class files to be considered. The same bytecode that runs on the JVM, such as the fact that it runs on multiple platforms without any portability issues. JVM runtime takes care of the problems at the platform dependent.


Therefore the Java programming language for the Java Virtual Machine knows nothing about. It only needs to know about the class file format. A class file Java virtual machine instructions (or bytecodes) is. Thus, the language in which to generate a valid class file can be hosted by the Java Virtual Machine. Implementation of the JVM, the Java class file format, you can only read and be able to perform operations properly. For security, the Java Virtual Machine byte code in a class file format and structural constraints it imposes strict.


2.Java Development Kit


A Java application development using Java Development Kit. JDK Java development environment provided by Sun’s JDK, you can also use a third-party alternative. Sun’s JDK you will build and test an application, it must be implemented with any third party.

java development kit

JDK core Java API and the building, testing and documenting programs that Java has some facilities. Java API classes, which will run the core functionality of the Java language. It’s like built-in data types, strings, flow control, exceptions, as well as graphics, network, and file IO capabilities are important language structures. JDK utilities can be accessed by some of the original command-line interfaces. For example, you may run the utility for editing the JDK, a command shell and type the command javac (Windows Command Prompt or Unix shell).


3. Download and Install the JDK


install jdk mac



Write and run a Java program that is essential to the development environment. After you install the JDK, you can run any Java program and is an environment where you can test. To enable Java, JDK installed on your system. The latest version of Sun’s Java JDK website (http://java.sun.com/j2se/1.4/) can be downloaded from. It is a self-extracting, compressed executable file that can be downloaded. On the website of the sun on your platform, you will need to locate the correct binary file. JDK installation process is straightforward. However, some manual steps that you need to do to complete the setup. In this Java Runtime Environment Basics Table 1. Windows and Linux platforms, you need to take the simple steps given below to install the JDK 1.4.


Table1. Java2 sdk1.4.x Installation Instructions


Steps Windows Linux
Check system requirements Microsoft 98/NT/XP/2000 on Intel Hardware Linux kernel v 2.2.12 and glibc v2.1.2-11 or later on any hardware
Download self-extracting binary file from http://java.sun.com/j2se/1.4/ Download file:
j2sdk-1_4_1_<version number>-windows-i586.exe
Download file:
j2sdk-1_4_1_<version number>-linux-i586.bin
Check the downloaded file‘s size Check if the file is downloaded completely. Check if the file is downloaded completely.
Installation Steps Run the Java 2 SDK installer file:
j2sdk-1_4_1_<version number>-windows-i586-i.exeDelete the downloaded file (Optional)Update the PATH* variable to include C:\j2sdk1.4.1_<version number>\bin
Copy self-extracting binary to the directory where you want to install the JDK.

Make the binary file executable.
$ chmod a+x j2sdk-1_4_1_<version number>-linux-i586.bin

Run the binary file as:
$ j2sdk-1_4_1_<version number>-linux-i586.bin

Java runtime environment is part of java.

*Note that changing the PATH variable in Windows 98, Windows NT / XP / 2000 that is different than that. PATH in Windows 98, you can edit the file AUTOEXEC.BAT (-> Run … -> sys edit start) is required. NT / XP / 2000 you need to modify the PATH environment variable. You can find this variable in the system control panel (Control Panel -> System -> Advanced -> Environment Variables).


4. JDK Utilities


JDK following are some important uses.


Javac : It is the Java compiler converts Java source code into Java bytecode.


Java : Java application bytecodes in the Java class files from the interpreter.


Javadoc : Java source code that creates HTML documentation and comments on the use of the Java documentation.


Jdb : If you program a line at a time by the Java debugger, set breakpoints, step and so on, to put a watch on a particular field.


Jar : The jar files generator creates a Java archive file. Jar files compressed files bundling together multiple Java classes and resources.JRE 7 and also JRE 8 these versions also latest

These tools are used to run Java applications and build. Figure 2. demonstrates how .Java applications built using JDK utilities. Java runtime environment by using a text editor and the .class files generated Java files to compile with javac. Java interpreter runs a Java .class file to create the output.


5. Building Java Applications with JDK




Now that you have installed JDK, it’s time to use it to build a Java application.Most of all us to create and run a small application Let’s classic Hello World example. In the process, you have to understand how to use the application to build the JDK utilities.

5.1 Java Source Code


Java source code can be written with a simple text editor. You can use the vi or Emacs editor on Unix and Windows you can use Notepad. You also have a comprehensive development environment (IDE) for Java, along with the editors of transportation can write your code. In that case, you need to know how to use a specific IDE. Us you will be using a simple text editor to be considered for further instructions Lett. Print a message to consider the application of a simple “Hello World!”.


java runtime environment

Java runtime environment HelloWorld class defines a Java code with method main (). HelloWorld class, tries to run the Java interpreter, the main () method looks for. To make it work properly in public, static void main method declaration is required for all keywords. We now have the key to almost learn more about this in Part 2 for a main () method, remember that every Java program, a Java application. JVM to run an application in the main () method implementation.

5.2  Compile  Source Code using  Javac


javac compiler can be executed in the Java interpreter or any other JVM converts Java source code into Java bytecodes. HelloWorld program by entering a shell prompt, you can compile the following:


javac HelloWorld.java


If the word is correct and acceptable to the Java compiler, the Java source code, no message will be displayed. After HelloWorld.java compile the file, HelloWold.class file is created. It is (virtually) any platform that can run on any JVM has bytecodes.


5.3 Java Application Using the Java Interpreter Running


After compiling HelloWorld.java, at the command prompt using the Java interpreter program (HelloWorld.class bytecodes) can be implemented.


Hello world


java HelloWorld


c:/>cd scjp_examples

c:/>scjp_examples>javac HelloWorld.java

c:/scjp_examples>java HelloWorld

Hello World!



HelloWorld.class Java interpreter Java class file bytecodes in the Java application to run. Above  a message “Hello World” is printed on the console after running the show.


Above, compile and run the HelloWorld application


HelloWorld.class Java interpreter runs to find the class file in the same directory in which the interpreter is running. Java class loader before running the code we’ve seen before, it loads all the required classes. It is, in order that the Java platform (bootstrap) classes, any extension classes, and classes by searching finds Classpath classes. Classpath is an important concept of the building so far and is subject to the execution of Java applets.maybe you can specify the Classpath:


  • Using the -classpath option when you invoke the JVM or other JDK using utilities


  • Using the CLASSPATH environment variable


In our example, HelloWorld.class can be found in the current directory, Classpath always. If your class is a Classpath, it will never be discovered or used by other Java classes.You are in a core API, the current directory or any of its subdirectories, and you want to load a class is not only the need to set the Classpath.

5.4 Java Runtime Environment (JRE)


java run time


In this files included in the subset of Java Development Kit (JDK). If you want your customers to distribute a Java application, you only need to run the program on a Java platform to provide them with a full JDK. JRE compiler, debugger, or other programming related tools do not have to. Instead, it is run Java applications with minimal runtime (JVM, JFC, JIT etc) environment.

For more Details Regarding Java Runtime Environment visit our website http://www.javaruntimeenvironment.org