Java Installation

Java SE(Standard Edition) is freely available on Oracle’s website, and it can be installed like any other software.

Check whether java is installed or not

In the command prompt enter command javac. If you see a screen like below means Java is Installed.
javac-346hwes
javac command is used to compile a Java program, it creates a class file which can be run by using java command.

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.

JDK with NetBeans

NetBeans IDE (Integrated development environment) also comes with JDK and it’s also freely available on Oracle’s website.

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:
C:\javac TestClass.java
Otherwise you need to specify the full path every time you run it, such as:
C:\Java\jdk1.7.0\bin\javac TestClass.java

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.
path-sg346

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 export tool rather than set. Let’s see how to set path in Linux OS:
Example:
export PATH=$PATH:/home/jdk1.7.0_21/bin/

Here, we have installed the JDK in the home directory under Root (/home).


                                                                      ⏪ PREVIOUS PAGE          NEXT PAGE ⏩

No comments:

Post a Comment