Java Development Kit (JDK) :


A Java Development Kit (JDK) is a program development environment for writing Java applets and applications. It consists of a runtime environment that "sits on top" of the operating system layer as well as the tools and programming that developers need to compile, debug, and run applets and applications written in the Java language.


Java Applet:


An applet is a little application. Prior to the World Wide Web, the built-in writing and drawing programs that came with Windows were sometimes called "applets." On the Web, usingJava, the object-oriented programming language, an applet is a small program that can be sent along with a Web page to a user. Java applets can perform interactive animations, immediate calculations, or other simple tasks without having to send a user request back to the server.




The Java Runtime Environment (JRE) is a set of software tools for development of Java applications. It combines the Java Virtual Machine (JVM), platform core classes and supporting libraries.

JRE is part of the Java Development Kit (JDK), but can be downloaded separately. JRE was originally developed by Sun Microsystems Inc., a wholly-owned subsidiary of Oracle Corporation.



Essentials Compiling & Running a Simple Program:


The computer age is here to stay. Households and businesses all over the world use computers in one way or another because computers help individuals and businesses perform a wide range of tasks with speed, accuracy, and efficiency. Computers can perform all kinds of tasks ranging from running an animated 3D graphics application with background sound to calculating the number of vacation days you have coming to handling the payroll for a Fortune 500 company.


When you want a computer to perform tasks, you write a program. A program is a sequence of instructions that define tasks for the computer to execute. This lesson explains how to write, compile, and run a simple program written in the Java language (Java program) that tells your computer to print a one-line string of text on the console.

But before you can write and compile programs, you need to understand what the Java platform is, and set your computer up to run the programs.


A Word About the Java Platform:


The Java platform consists of the Java application programming interfaces (APIs) and the Java 1virtual machine (JVM).


Java APIs are libraries of compiled code that you can use in your programs. They let you add ready-made and customizable functionality to save you programming time.

The simple program in this lesson uses a Java API to print a line of text to the console. The console printing capability is provided in the API ready for you to use; you supply the text to be printed.


Java programs are run (or interpreted) by another program called the Java VM. If you are familiar with Visual Basic or another interpreted language, this concept is probably familiar to you. Rather than running directly on the native operating system, the program is interpreted by the Java VM for the native operating system. This means that any computer system with the Java VM installed can run Java programs regardless of the computer system on which the applications were originally developed.


For example, a Java program developed on a Personal Computer (PC) with the Windows NT operating system should run equally well without modification on a Sun Ultra workstation with the Solaris operating system, and vice versa.


Setting Up Your Computer:


Before you can write and run the simple Java program in this lesson, you need to install the Java platform on your computer system.

The Java platform is available free of charge from the Java web site. You can choose between the Java® 2 Platform software for Windows 95/98/NT or for Solaris. The download page contains the information you need to install and configure the Java platform for writing and running Java programs.


Note: Make sure you have the Java platform installed and configured for your system before you try to write and run the simple program presented next.

Writing a Program:


The easiest way to write a simple program is with a text editor. So, using the text editor of your choice, create a text file with the following text, and be sure to name the text Java programs are case sensitive, so if you type the code in yourself, pay particular attention to the capitalization.

//A Very Simple Example
class ExampleProgram {
  public static void main(String[] args){
    System.out.println("I'm a Simple Program");


Here is the source code file if you do not want to type the program text in yourself.


Compiling the Program


A program has to be converted to a form the Java VM can understand so any computer with a Java VM can interpret and run the program. Compiling a Java program means taking the programmer-readable text in your program file (also called source code) and converting it to bytecodes, which are platform-independent instructions for the Java VM.

The Java compiler is invoked at the command line on Unix and DOS shell operating systems as follows:



Note: Part of the configuration process for setting up the Java platform is setting the class path. The class path can be set using either the -classpath option with the javac compiler command and java interpreter command, or by setting the CLASSPATH environment variable. You need to set the class path to point to the directory where the ExampleProgram class is so the compiler and interpreter commands can find it. See Java 2 SDK Tools for more information.


Interpreting and Running the Program


Once your program successfully compiles into Java bytecodes, you can interpret and run applications on any Java VM, or interpret and run applets in any Web browser with a Java VM built in such as Netscape or Internet Explorer. Interpreting and running a Java program means invoking the Java VM byte code interpreter, which converts the Java byte codes to platform-dependent machine codes so your computer can understand and run the program.

The Java interpreter is invoked at the command line on Unix and DOS shell operating systems as follows:

  java ExampleProgram

At the command line, you should see:

  I'm a Simple Program

Here is how the entire sequence looks in a terminal window:


Common Compiler and Interpreter Problems


If you have trouble compiling or running the simple example in this lesson, refer to the Common Compiler and Interpreter Problems lesson in The Java Tutorial for troubleshooting help.


Code Comments


Code comments are placed in source files to describe what is happening in the code to someone who might be reading the file, to comment-out lines of code to isolate the source of a problem for debugging purposes, or to generate API documentation. To these ends, the Java language supports three kinds of comments: double slashes, C-style, and doc comments.


Double Slashes


Double slashes ( //) are used in the C++ programming language, and tell the compiler to treat everything from the slashes to the end of the line as text.

//A Very Simple Example
class ExampleProgram {
  public static void main(String[] args){
    System.out.println("I'm a Simple Program");


C-Style Comments

Instead of double slashes, you can use C-style comments ( /* */) to enclose one or more lines of code to be treated as text.

/* These are
C-style comments
class ExampleProgram {
  public static void main(String[] args){
    System.out.println("I'm a Simple Program");


Doc Comments


To generate documentation for your program, use the doc comments ( /** */) to enclose lines of text for the javadoc tool to find. The javadoc tool locates the doc comments embedded in source files and uses those comments to generate API documentation.

/** This class displays a text string at
*  the console.
class ExampleProgram {
  public static void main(String[] args){
    System.out.println("I'm a Simple Program");



HTML javadoc Home Page javadocAPI Documentation


The Java platform installation includes API Documentation, which describes the APIs available for you to use in your programs. The files are stored in a doc directory beneath the directory where you installed the platform. For example, if the platform is installed in /usr/local/java/jdk1.2, the API Documentation is in /usr/local/java/jdk1.2/doc/api. More Information

See Java 2 SDK Tools for more information on setting the class path and using the javac, andjava commands.

See Common Compiler and Interpreter Problems lesson in The Java Tutorial for troubleshooting help.

The javadoc Home Page has more information on the javadoc command and its output.

You can also view the API Documentation for the Java 2 Platform on the Java Sun site.

JVM? JDK? JEE? Java technobabble explained


It has come to my attention recently that there is some confusion (even among quite knowledgeable technical people) about the correct usage of Java terms like JDK, JVM, etc. I think this springs from the fact that a lot of developers use them interchangeably, assuming that the other person will understand the meaning from the context. Some of the acronyms are even used commonly by developers in places where they don't even make sense.

I thought I'd make a public service blog defining some of these terms as I've seen and heard them used, to help others who might need this information for their work.

Who should read this? People who are not Java developers: marketing and sales people, technical writers, support staff, others without a lot of Java experience. This post intentionally skips over many technical details.


The Java Virtual Machine (JVM) is the piece of software that runs a Java application. All Java software runs "in" or "on" a JVM. All JVMs provide the same environment for your application to run in, which allows a Java application to run on Windows, Linux, Mac and many other platforms.

Sun develops the most popular JVM implementation and provides it for Windows, Linux and Solaris. The JVM for Mac OS X is developed by Apple. BEA and IBM have implementations of the JVM, and there are a few minor open source ones. Although it's not used often, the term Java Runtime Environment (JRE) means an implementation of the JVM and all the other stuff you need to run a Java application. You might hear people say "the Sun JRE" or "the BEA JRockit JRE" in reference to this.

Before we go much further, I should explain a bit more about how application programming interfaces (APIs) work and the word "implementation" actually means. API is a very vague term and basically means "someone else's code you run to do stuff". Because you might want to do the same stuff in different places (like on Windows and Mac), most APIs just standardise the way you ask for something to be done. Animplementation of that API actually has the code that is executed when you ask for it to happen. This is how Java APIs work. There is a diagram on the right that shows this graphically.

Diagram explaining how APIs work
How APIs work

As I mentioned above, it is because each JVM provides the same environment that Java applications can be run on different platforms. This environment is called the Java Platform, Standard Edition (Java SE), or informally, the JDK. It consists of a framework of about 3700 classes. These classes must be implemented according to this specification in every JDK. Sun defines this specification.

The Java Platform, or JDK, has evolved over time so there are several versions of it. The latest major version is Java SE 6 or JDK 6. Our applications are mostly written against either version 1.4 or 5, which are both still supported by Sun.

Even though the Java Platform is often called the JDK, the correct definition is very different. As originally defined, the Java Development Kit (JDK) is actually a combination of Java compilation tools and API implementation for a particular version of the Java Platform. It also typically includes a Java runtime (JRE), so that you can run the programs you compile.

It is in the usage of the term "JDK" that most of the confusion arises. For reasons I don't understand, it has become commonplace to hear the version of the platform one is running referred to as one's JDK. You can say "download the Sun JDK" to mean download the Sun Java compiler and associated tools, but it's also common to hear "Confluence requires JDK 5" which is about what version of the Java API that Confluence uses, not specifically related to the compiler itself. While the latter form is in common use, it would be better to say "Confluence requires Java 5", which is commonly used and also technically correct.

Java Enterprise Edition (JEE), formerly Java 2 Enterprise Edition or J2EE, is a collection of APIs which aren't included in the standard JDK but provide functionality which is useful for many server applications. One example is JavaMail, which is a standard way of accessing email from Java. This isn't available with the standard JDK, but Sun has provided a standard API and implementation for people to use in Java applications.

Application servers provide implementations of many of the JEE standards. Most important to Atlassian applications are the Java Servlet API, the Java Transaction API and the data source APIs in JEE. We also rely quite heavily on a front-end technology called JavaServer Pages (JSP). People talk about "JEE application servers" or just "application servers". You don't often hear JEE or J2EE mentioned when talking about versions or application requirements, except in the most technical discussions.


Because these terms can be used either correctly, informally or incorrectly, I've split the examples into three sections.

Correct usage

  • "You need to install a JDK to compile a Java program"
  • "You need to configure your JVM parameters to increase the memory allocation"
  • "I don't understand why Java SE doesn't include support for email"
  • "You need to be running Java 1.4 or later to use JIRA 3.10"
  • "Bamboo uses the JEE APIs for database access and email notifications"
  • "You need a JEE application server to run Atlassian applications"

Dubious common usage


  • "You need to be running JDK 5 or later to use Confluence 2.9" – should use "Java 5"
  • "IBM's JDK is supported for running JIRA, but we recommend using the Sun JDK" – technically correct would be "JVM" not "JDK"
  • "You need a JEE server to run Crowd" – better to say "Java application server", or specify which JEE standards you need, e.g. "You need a servlet container ..."

Incorrect usage


  • "You need to use Java SE 5 to run Confluence" – should just use "Java 5"
  • "Which Java SE version are you using?" – should just use "Java"
  • "I've installed the Java API" – you can only install an implementation of an API, not the API itself. You probably mean "the JRE" or "the JDK"
  • "Which JEE are you using?" – say "Java version" or "application server" instead of "JEE"
  • "Storm the Java" – err?

Of course, there are many ways to mash the terms together so they don't make sense at all. I'm sure I don't need to provide any examples of that.

Intentional simplifications:


Some notes for the narky developers out there who will argue with my definitions on the basis of minor technical concerns. I have intentionally omitted the following details:

  • There's an important distinction between programs written in Java and bytecode that can run on the JVM. However, explaining the difference between bytecode, machine code and Java code is too technical for this discussion.
  • While the JVM specification defines the runtime environment, the API is in fact separate to this. This is mostly just a theoretical separation. You could run stuff on the JVM that doesn't use the Java API, but I can't imagine you'd be able to do much with it. Therefore, all JVMs include a Java API implementation, and other languages that use the JVM build on top of the Java API.
  • The Java language specification is also separate to the Java API and the JVM specification. Discussing a language separate to its most common implementation is too technical for this post.
  • J2ME has a so-called JVM which doesn't follow the JVM specification. Go figure. It also doesn't ship with a standard set of class libraries like the Java SE Platform.
  • A JDK doesn't technically require a JRE to do its job, but almost all of them include one. Likewise, there are Java compilers written that ship without a API implementation, so a JDK doesn't technically require an API implementation. Some Java compilers can compile to machine code rather than bytecode, in which case an API implementation isnecessary.
  • Java 1.4 was called Java 2 SE 1.4 when it was released, but explaining Java's history of version numbering is overly complex and not necessary for this discussion. I'd actually prefer to call it Java 4, but retroactively applying the new version numbering system to old releases could be confusing. Java 5 is versioned internally as 1.5, and Java 6 is 1.6.

JRE JVM and JDK in Java Programming language


Java Runtime Environment (JRE)


Java is every where in browser, in mobile, in TV or in set-top boxes and if you are into Java programming language than you know that Java code which is bundled in JAR (Java archive) file require Java virtual machine JVM to execute it. Now JVM is an executable or program like any other program and you can install that into your machine. You have seen browser often suggesting download JRE to run a Java Applet downloaded from Internet. Various version of JRE are available in and most of the user who just want to execute Java program inside browser or standalone downloads JRE. All browsers including Internet Explorer, Firefox and Chrome can work with JRE.


Java Virtual Machine (JVM)


When you download JRE and install on your machine you got all the code required to create JVM. Java Virtual Machine is get created when you run a java program using java command e.g. java HelloWorld. JVM is responsible for converting byte code into machine specific code and that's why you have different JVM for Windows, Linux or Solaris but one JAR can run on all this operating system. Java Virtual machine is at heart of Java programming language and provide several feature to Java programmer including Memory Management and Garbage Collection, Security and other system level services. Java Virtual Machine can be customized e.g we can specify starting memory or maximum memory of heap size located inside JVM at the time of JVM creation. If we supplied invalid argument to java command it may refuse to create Java Virtual Machine by saying "failed to create Java virtual machine: invalid argument". In short Java Virtual Machine or JVM is the one who provides Platform independence to Java.


Java Development Kit (JDK)


JDK is also loosely referred as JRE but its lot more than JRE and it provides all the tools and executable require to compile debug and execute Java Program. Just like JRE, JDK is also platform specific and you need to use separate installer for installing JDK on Linux and Windows. Current Version of JDK is 1.7 which is also referred as Java7 and it contains javac (java compiler) based on programming rules of Java7 and Java which can execute java7 code with new features like String in Switch, fork-join framework or Automatic Resource Management. When you install JDK, installation folder is often referred as JAVA_HOME. All binaries are located inside JAVA_HOME/bin which includes javac, java and other binaries and they must be in your system PATH in order to compile and execute Java programs. For details on Path see how to set PATH for Java in Windows and UNIX.


Difference between JRE, JDK and JVM:

In short here are few differences between JRE, JDK and JVM:


1)  JRE and JDK come as installer while JVM are bundled with them.

2)  JRE only contain environment to execute java program but doesn’t contain other tool for compiling java program.

3)  JVM comes along with both JDK and JRE and created when you execute Java program by giving “java” command.


Just in Time Compiler (JIT)

Initially Java has been accused of poor performance because it’s both compiles and interpret instruction. Since compilation or Java file to class file is independent of execution of Java program do not confuse. Here compilation word is used for byte code to machine instruction translation. JIT are advanced part of Java Virtual machine which optimize byte code to machine instruction conversion part by compiling similar byte codes at same time and thus reducing overall execution time. JIT is part of Java Virtual Machine and also performs several other optimizations such as in-lining function.


That’s all on JRE, JDK and Java Virtual machine and difference between them. Though they look similar they are different and having a clear idea of JVM, JIT or JDK helps in java programming.



Lesson 1: Compiling and Running a Simple Program

Lesson 2: Building Applications

Lesson 3: Building Applets

Lesson 4: Building a User Interface

Lesson 5: Writing Servlets

Lesson 6: File Access and Permissions

Lesson 7: Database Access and Permissions

Lesson 8: Remote Method Invocation

In Closing

Print Print | Sitemap
© 2016 Automation Learn. All rights reserved.