Saturday, January 10, 2015

JDK JRE


JDK :
  JDK stands for Java Development Kit or sometimes it is also referred as Java Standard Edition Development Kit. JDK is a development environment to develop wide range of applications such as desktop applications, web applications or mobile applications using Java programming language.

jdk


JRE :
  Java Runtime Environment,JDK stands for Java Development Kit or sometimes it is also referred as Java Standard Edition Development Kit. JDK is a development environment to develop wide range of applications such as desktop applications, web applications or mobile applications using Java programming language.


jre




JRE
(Java Runtime environment)
JDK
(Java Development Kit)
It is an implementation of the Java Virtual Machine* which actually executes Java programs.
It is a bundle of software that you can use to develop Java based applications.
Java Runtime Environment is a plug-in needed for running java programs.
Java Development Kit is needed for developing java applications.
The JRE is smaller than the JDK so it needs less Disk space.
The JDK needs more Disk space as it contains the JRE along with various development tools.
The JRE can be downloaded/supported freely from
The JDK can be downloaded/supported freely from
It includes the JVM , Core libraries and other additional components to run applications and applets written in Java.
It includes the JRE, set of API classes, Java compiler, Webstart and additional files needed to write Java applets and applications.






 JDK is created for Java programmers, and contains tools required for Java programming, e.g. javac for compiling Java source files to .class files. Without JDK, you can not create Java applications and programs. By the way JDK comes with it's own JRE, but when you run Java program using javacommand, the JRE which comes first in System PATH is used for execution. One of the important thing to know is that, you can not run Java program from your machine if you don't have either JRE or JDK. You can also consider JDK as super set, which also contains JRE. For a normal user, installing JDK is overkill.


JVM, JRE and JDK




JDK (Java Development Kit)

Java Development Kit (JDK) is a bundle of software components that is used to develop Java based applications. JDK is an implementation of either of Java SE, Java EE or Java ME. Usually, learners start from JDK implementation of Java SE to learn core Java features, which is also known as Java SDK. JDK includes the JRE, set of API classes, Java compiler, Webstart and additional files needed to write Java applets and applications. Java Development Kit is a bundle of the following software components that are needed to develop Java based applications.


§  Java Compiler: 
There are two ways to pass source code file names to javac:
o   For a small number of source files, simply list the file names on the command line separated by blank space. For example:
D:\JavaPrograms>javac SelectionSortDemo.java SequentialSearchDemo.java
o   For a large number of source files, list the file names in a file, separated by blanks or line breaks. Then use the list file name on the javac command line, preceded by an @ character. For an example, store three source file namesSelectionSortDemo.javaSequentialSearchDemo.java,SystemOutPrintlnDemo.java in a file named source-file-list and then supply following command in order to compile the source code files stored in source-file-list.
D:\JavaPrograms>javac @source-file-list
Inner class definitions produce additional class files. These class files have names combining the inner and outer class names, such asMyClass$MyInnerClass.class    
§  Java compiler is javac tool located in /bin folder of the JDK installation directory. The javac tool (accessed using javac command) reads class and interface definitions, written in the Java programming language, and compiles them into bytecode class files. It can also process annotations in Java source files and classes.




§  Java Interpreter: Java interpreter is used to interpret the .class Java files that have been compiled by Java compiler (javac). Java interpreter is accessed usingjava command. The java command starts a Java application. It does this by starting a Java runtime environment, loading a specified class, and calling that class's main method.
The method must be declared public and static, it must not return any value, and it must accept a String array as a parameter. The method declaration has the following form:
public static void main(String[] args)
By default, the first argument without an option is the name of the class to be called. A fully qualified class name should be used. If the -jar option is specified, then the first non-option argument is the name of a JAR file containing class and resource files for the application, with the startup class indicated by the Main-Class manifest header.
The Java runtime searches for the startup class, and other classes used, in three sets of locations: the bootstrap class path, the installed extensions, and the user class path.
Non-option arguments after the class name or JAR file name are passed to the main function.
§  Java Disassembler: The javap command is the disassembly tool of JDK that disassembles one or more class files. Its output depends on the options used. If no options are used, javap prints out the package, protected, and public fields and methods of the classes passed to it. The javap prints its output to stdout.
§  Java Header File Generator: Java Header File Generator (javah command-line tool) generates C header and source files that are needed to implement native methods. The generated header and source files are used by C programs to reference an object's instance variables from native source code. The .h file contains a struct definition whose layout parallels the layout of the corresponding class. The fields in the struct correspond to instance variables in the class.
The name of the header file and the structure declared within it are derived from the name of the class. If the class passed to javah is inside a package, the package name is prepended to both the header file name and the structure name. Underscores (_) are used as name delimiters.
By default javah creates a header file for each class listed on the command line and puts the files in the current directory. Use the -stubs option to create source files. Use the -o option to concatenate the results for all listed classes into a single file.
The new native method interface, Java Native Interface (JNI), does not require header information or stub files. The javah tool can still be used to generate native method function prototypes needed for JNI-style native methods. Thejavah tool produces JNI-style output by default, and places the result in the .hfile.
§  Java Documentation: Java Documentation helps to maintain code. Thejavadoc tool comes as part of Java Development Kit that parses the declarations and documentation comments in a set of Java source files and produces a corresponding set of HTML pages describing (by default) the public and protected classes, nested classes (but not anonymous inner classes), interfaces, constructors, methods, and fields. You can use it to generate the API (Application Programming Interface) documentation or the implementation documentation for a set of source files.
You can run the javadoc tool on entire packages, individual source files, or both. When documenting entire packages, you can either use -subpackages for traversing recursively down from a top-level directory, or pass in an explicit list of package names. When documenting individual source files, you pass in a list of source (.java) file names.
§  Java Debugger: The Java Debugger, jdb, is a simple command-line debugger for Java classes. It is a demonstration of the Java Platform Debugger Architecturethat provides inspection and debugging of a local or remote Java Virtual Machine.
§  Java Applet Viewer: This is used to view the Java applets. The appletviewercommand connects to the documents or resources designated by urls and displays each applet referenced by the documents in its own window. Note: if the documents referred to by urls do not reference any applets with the OBJECT, EMBED, or APPLET tag, then appletviewer does nothing. For details on the HTML tags that appletviewer supports, see AppletViewer Tags.

 

 

 

 

JRE (Java Runtime Environment)

JRE is an implementation of the JVM which actually executes Java programs. It includes the JVM, core libraries and other additional components to run applications and applets written in Java. Java Runtime Environment is a must install on machine in order to execute pre compiled Java Programs. JRE is smaller than the JDK so it needs less disk space and it is so because JRE does not contain Java compiler and other software tools needed to develop Java programs.

 

 

 

 

Difference Between JRE and JDK


JRE (Java Runtime environment)
JDK (Java Development Kit)
JRE is an implementation of the Java Virtual Machine which actually executes Java programs.
JDK is a bundle of software that is used to develop Java based applications.
Java Runtime Environment is a plug-in needed for running Java programs.
Java Development Kit is needed for developing Java applications.
JRE is smaller than the JDK so it needs less disk space.
JDK needs more disk space as it contains the JRE along with various development tools.
JRE includes the JVM, Core libraries and other additional components to run applications and applets written in Java.
JDK includes the JRE, set of API classes, Java compiler, Webstart and additional files needed to write Java applets and applications.

 






No comments:

Post a Comment