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.

Do you want to know how to develop your skillset to become a Java Rockstar?

Subscribe to our newsletter to start Rocking right now!

To get you started we give you two of our best selling eBooks for FREE!

JPA Mini Book

Learn how to leverage the power of JPA in order to create robust and flexible Java applications. With this Mini Book, you will get introduced to JPA and smoothly transition to more advanced concepts.

JVM Troubleshooting Guide

The Java virtual machine is really the foundation of any Java EE platform. Learn how to master it with this advanced guide!

Given email address is already subscribed, thank you!
Oops. Something went wrong. Please try again later.
Please provide a valid email address.
Thank you, your sign-up request was successful! Please check your e-mail inbox.
Please complete the CAPTCHA.
Please fill in the required fields.
Examples Java Code Geeks and all content copyright © 2010-2014, Exelixis Media Ltd | Terms of Use | Privacy Policy | Contact
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.
Do you want to know how to develop your skillset and become a ...
Java Rockstar?

Subscribe to our newsletter to start Rocking right now!

To get you started we give you two of our best selling eBooks for FREE!

Get ready to Rock!
You can download the complementary eBooks using the links below:
Close