Sotirios-Efstathios Maneas

About Sotirios-Efstathios Maneas

Sotirios-Efstathios (Stathis) Maneas is a postgraduate student at the Department of Informatics and Telecommunications of The National and Kapodistrian University of Athens. His main interests include distributed systems, web crawling, model checking, operating systems, programming languages and web applications.

Java Development Kit: Starting with the Java JDK

In this tutorial we will present and describe the Java Development Kit (JDK). The JDK is a development environment for building applications, applets and components, using the Java programming language. The JDK among others includes the Java Runtime Environment (JRE), the Java compiler (Javac) and the Java APIs. The tools offered by the JDK are written in the Java programming language and can be executed on the Java platform.

In this tutorial we will show you how to install and use the Java Development Kit in a Windows 7 computer, with a 64-bit architecture and with Java 1.7.0_51 currently installed.

Download the JDK for Windows

  • First of all, you must visit the official download page here.
  • Then, you must accept the Oracle’s License agreement, in order to be able to download the JDK.
  • Find and click on the version that corresponds to your machine’s architecture, either 32-bit or 64-bit.
  • In the appearing dialog box, click on Save, in order to download the file to your local system.
  • Close all running applications, including the web browser.

Install the JDK in Windows

Once the download procedure is complete, we are ready to install Java in our machine. Navigate to the folder where the executable file is located and double click on it, in order for the installation to start.

Click on Next on the appearing dialog box:

jdk_1.7_51_install_WM

Then, if you don’t want to change the default installation directory of Java, click on Next:

jdk_1.7_51_install_setup_WM

A new dialog box shall appear that aims to install the new JRE. Again, if you don’t want to change the default installation directory, click on Next:

jdk_1.7_51_install_jre_WM

Wait for the JRE installation to complete. If no errors were encountered during the installation, the following dialog box shall appear:

jdk_1.7_51_install_complete_WM

Close the window. Well done, the latest version of the JDK has been installed to your computer!

Start using the JDK

As we already mentioned, the JDK contains the JRE and the Javac. These tools enable the development and execution of Java applications and applets.

Using your favorite text editor, copy and paste the following code snippet:

HelloWorld.java:

class SampleExample {
     public static void main(String[] args) {
          System.out.println(“Hello World!”);
     }
}

Using the Windows command line, navigate to the directory that contains the newly created HelloWorld.java file and execute the following command:

javac HelloWorld.java

This command makes use of the Java Compiler, which compiles our source program and creates the HelloWorld.class file. This file contains Java bytecode that can be executed by the following command:

java HelloWorld

The output of the aforementioned command is:

Hello World!

Notice that in case your source code contains errors, Javac will report each one of them. Obviously, you must fix them in order for the compilation procedure to complete.

Final Comments on the JDK

  • The development procedure of an application can be improved if you make use of the existing IDEs for Java, such as Eclipse and Netbeans. These IDEs provide a full programming environment for both development and execution of Java applications.
  • The JDK includes a bunch of useful and important tools, such as:
    • Appletviewer:  The Appletviewer is used to run and debug Java applets without a Web browser.
    • Javadoc: The Javadoc tool extracts all comments in a special format from Java source files and generates a HTML file tree that contains them.
    • Jar: Jar is an archive tool that packages multiple files into a single .jar archive file.
    • Jarsigner: The jarsigner is a Java application that is used to generate signatures for .jar files and to verify the signatures of signed .jar files.
    • Javaws: The Java Web Start software allows you to download and run Java applications from the Web. For more information, please to the Java Web Start tutorial here.
    • pack200: The pack200 tool is a Java application that transforms a .jar file into a compressed pack200 file using Java’s gzip compressor.

 
This was a tutorial on how to install and get started with the latest JDK in Windows.

Related Whitepaper:

Java Essential Training

Author David Gassner explores Java SE (Standard Edition), the language used to build mobile apps for Android devices, enterprise server applications, and more!

The course demonstrates how to install both Java and the Eclipse IDE and dives into the particulars of programming. The course also explains the fundamentals of Java, from creating simple variables, assigning values, and declaring methods to working with strings, arrays, and subclasses; reading and writing to text files; and implementing object oriented programming concepts. Exercise files are included with the course.

Get it Now!  

Examples Java Code Geeks and all content copyright © 2010-2014, Exelixis Media Ltd | Terms of Use | Privacy Policy
All trademarks and registered trademarks appearing on Examples Java Code Geeks are the property of their respective owners.
Java is a trademark or registered trademark of Oracle Corporation in the United States and other countries.
Examples Java Code Geeks is not connected to Oracle Corporation and is not sponsored by Oracle Corporation.

Sign up for our Newsletter

20,709 insiders are already enjoying weekly updates and complimentary whitepapers! Join them now to gain exclusive access to the latest news in the Java world, as well as insights about Android, Scala, Groovy and other related technologies.

As an extra bonus, by joining you will get our brand new e-books, published by Java Code Geeks and their JCG partners for your reading pleasure! Enter your info and stay on top of things,

  • Fresh trends
  • Cases and examples
  • Research and insights
  • Two complimentary e-books