Java SE(Standard Edition) is freely available on Oracle's website, and it can be installed like any other software.
Java Development Kit (JDK)
JDK (Java SE Development Kit) Includes a complete JRE (Java Runtime Environment) plus tools for developing, debugging, and monitoring Java applications. After downloading the SDK, follow the instructions of the installation package.
NetBeans IDE (Integrated development environment) also comes with JDK, and it's also freely available on Oracle's website.
After the JDK installation, some folders will be created on your hard drive. These are - bin, demo, include, jre, lib, src.
- bin - This folder contains a compiler and other development tools.
- demo - An example demo program to understand different features of Java.
- include - In this, files are integrated to integrate Java with other languages.
- jre - This folder contains runtime environment files.
- lib - This folder contains Java library files.
- src - This folder contains source code for Java API classes.
Some essential tools exist in the bin folder:
- javac - This is Java compiler.
- java - This is an interpreter.
- Appletviewer - This is used to view applet.
- javap - It is used to convert bytecode into program description.
- javah - This includes header files.
- javadoc - It is used for the HTML document.
Check Whether Java Is Installed or Not
At the command prompt enter command javac. If you see a screen like below, it means Java is Installed.
javac command is used to compile a Java program; it creates a class file which can be run by using java command.
Setting up the Environment Variables
Once you installed Java on your machine, it is required to Set the PATH environment variable to conveniently run the executable (javac.exe, java.exe, javadoc.exe, and so on) from any directory without having to type the full path of the command, such as:
Otherwise, you need to specify the full path every time you run it, such as:
Set path of JDK in Windows
- Suppose you have installed Java in C:\Program Files\Java\jdk1.7.0_21\bin directory
- Right-click on My Computer icon and select Properties.
- Click on the 'Environment variables' button under the 'Advanced' or 'Advanced system settings' tab.
- Add Path as new variable name and C:\Program Files\Java\jdk1.7.0_21\bin as variable value.
Setting Path in Linux OS
Setting the path in Linux OS is same as setting the path in the Windows OS. But here we use the export tool rather than set. Let's see how to set path in Linux OS:
Here, we have installed the JDK in the home directory under Root (/home).
Here are few other related articles for you to read: