First you need some Java development software. You can choose from several products. In fact, you may already have one of these products on your own computer. If you don't, you can download the basic software by visiting a Sun Microsystems Web site. The product that you want to download is known by a few different names. It's called the Java Development Kit (JDK), the Java Software Development Kit (SDK), and the Java Standard Edition (Java SE). You may even see an extra 2 in a name like Java 2 Standard Edition (J2SE), but the 2 doesn't mean anything. (Sun Microsystems added the 2 several years ago and then dropped the 2 in 2006.)

Applicable to the Windows platform, use the following instructions to download and install the JDK:

Downloading & Installing the JDK

Before you can develop Java applications, you'll need to download the Java Development Kit (JDK). You may prefer at a later time to use a third party IDE, such as Visual J++ or Borland JBuilder, but it is important to become familiar with the basics of Java first.

You should always use third party tools in combination with Sun's JDK, not exclusion, to ensure compatibility.

Installing the JDK

Sun offers many versions of its JDK, for different Java versions and platforms. You are advised to use the most recent JDK, to gain access to all of the functionality of the latest version of the Java platform. If you don't already have the JDK installed, then stop off at Sun's official Java site, http://java.sun.com/.

For an even quicker way to find the latest Java tools, visit the JDK download page, located at JDK 7 and JRE 7 Installation Guide. The most current version at time of writing is the JDK 8 and JRE 8 Installation Start Here, which contains all the tools you will need for this tutorial.

The installation process is fairly straightforward, but you should consult the documentation if you encounter problems. You'll need to make sure that the JDK is installed correctly, and that the JDK tools are within your operating system's path, before proceeding.

In most cases, this involves setting environmental variables. As many first-time Java developers do not have experience in this, we'll show you how to set these, for the most popular Java development environment -- Windows. Macintosh, Unix, and other environments, have their own way of setting environmental variables (for more information consult your operating system documentation).

  1. Visit java.sun.com.

  2. Find a link to download the Java SE 8 (the Java Standard Edition, version 8).

    If you find some other version. Just make sure that you have a version numbered 6 or higher.

  3. Download the JDK, not the JRE.

    To create your own Java programs, you need more than the JRE. You need the entire JDK.

  4. Double-click the icon of the downloaded file and follow the wizard's instructions for installing the JDK.

    You can choose to have some or all of the components installed. Just make sure that your choice includes the development tools and the JRE.

    You also see the name of the directory in which the JDK is to be installed. Jot down the exact name of the directory.

    At some point, the wizard asks whether you want to register your Web browser with the latest Java plug-in. It's a good idea.

    5. Return to the page where you found the JDK download. Get another download — the Java SE Documentation (also known as the Java SE API Documentation).

    6. Extract the zipped Java SE Documentation to your Java home directory.

    After you download the Java JDK, you're ready to install the software on your computer. Of course, you can do this 900 different ways, depending on your operating system, the names of directories on your hard drive, the wind velocity, and other factors. The following steps offer some guidelines:

  5. Open My Computer and find the JDK file that you downloaded.

    The file has a name like jdk-6-blah-blah.exe. The exact name depends on the operating system you're using, the version number that Sun has reached with Java, and whatever naming conventions the people at Sun have changed since this book was written.

  6. Double-click the JDK file's icon.

    • If you downloaded the tiny online installation file, your computer downloads more files from the Internet and installs Java while it downloads.

    • If you downloaded the huge offline installation file, your computer extracts the contents of the huge setup file and installs Java from these contents.

  7. Among the features that you select to install, make sure you select Development Tools and Public Java Runtime Environment.

    You can choose to have some or all of the components installed. Just make sure that your choice includes these two items. To select or un-select an item, click the icon to the left of the item's name.

  8. Jot down the name of the directory in which the Java SDK is being installed and then click Next.

    From one version to the next, the installation package puts Java in different directories on the computer's hard drive. Lately the package has installed Java in a directory named C:\Program Files\Java\jdk1.6.0. During the installation on your computer, you may see a different directory name. (One way or another, the name probably has jdk in it.)

    Take note of this directory name when the installation package displays it. This directory is called your Java home directory.

  9. Enjoy the splash screens that you see while the software is being installed.

    At the end of the installation, you click the proverbial Finish button. But you're still not done with the whole kit 'n caboodle. The next step is installing the Java documentation.

  10. Copy the documentation to your Java home directory.

  11. Check to make sure that you unzipped the documentation correctly.

    After unzipping the documentation's Zip file, you should have a subdirectory named docs in your Java home directory. So open My Computer and navigate to your new jdkwhatever folder. Directly inside that folder, you should see a new folder named docs. This directory is called your Javadoc directory.

    When your docs are all lined up in a row, you can proceed to the next step — installing a Java development environment.

Free Integrated Development Environments (IDE)

Here are 18 of the best free Java IDE software programs. These let you create various useful Java applications easily. All these Java IDE software are completely free and can be downloaded to Windows PC. These free software offer various features, like: lets you build Java applications, testing for JUnit, TestNG, debugging, code inspections, code assistance, support for multiple refactorings, Maven build tools, ant, visual GUI builder and code editor for XML, Java, make backend server, do data modeling and build queries, builds classes in Java and transform tables into objects in Java, lets you build cross platform and professional mobile, web, enterprise and desktop applications etc. So, go through this list of free Java IDE software and see which ones you like the most.

  1. IntelliJ IDEA Community Edition
  2. Java Inventor
  3. NetBeans IDE
  4. NaviCoder IDE for Java
  5. Jcoder Java IDE and Compiler
  6. SkyIDE
  7. Enide Studio 2014
  8. ObjectScript
  9. Java Development Kit
  10. BlueJ
  11. DrJava
  12. Eclipse
  13. Javelin
  14. jEdit
  15. jGRASP
  16. JSource
  17. JotAzul
  18. Asterix IDE

Writing your first programs

A template for your first program might look like:

 

public class Switch {

   public static void main( String args[] ) {
       code goes here
       ...      
   }
}
 
Figure 1: Java application template


Another set of examples can be found at Tutorial: A Second Cup of Java.

Definitions

programming language -

    Programming Language A vocabulary and set of grammatical rules for instructing a computer to perform specific tasks. The term programming language usually refers to high-level languages, such as BASIC, C, C++, COBOL, FORTRAN, Ada, and Pascal.

template

    template (n.) (1) Something that establishes or serves as a pattern for reference. (2) A plastic or paper diagram that you can put on your keyboard to indicate the meanings of different keys for a particular program.