Today we will talk about installing the jdk on a windows or a linux machine. The installation process is fairly simple but you will have to take care when installing the jdk.
Download the latest jdk from the following link http://java.sun.com/javase/downloads/index.jsp that matches your operating system platform
Installing the JDK on a windows machine
1. The installation process is really simple. All what you need to do is to click the installer you downloaded i.e. jdk-<version>-windows-i586-i.exe and proceed with the installation steps. After finishing the installation process you may be asked to reboot the system.
2. For the convenience of not typing the full path of the java commands every time, it is recommended to set the PATH environment variable . To do that
i. Click Start->Control Panel-> System
ii. Click Advanced-> Environment variables
iii. Append the path of the jdk to the PATH variable for the user and system variables. Be careful at this step so that you don't remove any existing directories by mistake
iv. If you have installed the jdk at the C drive inside the Program Files folder the path will be C:\Program Files\Java\jdk<version>\bin
v. Check if there is any existing value pointing to any installed jdk. If there happens to be one, update it to the directory of the newly installed jdk
vi. Remember that Windows reads the programs directories from left to right and that the environment variables values are not case sensitive
vii. In case there is no existing value for any jdk, place the directory of the jdk at the left and be sure to place a semi colon ";" after the jdk directory
viii. Press apply and you're done
Installing the JDK on a linux machine
If you downloaded the .bin package
1. Get the root permissions by logging as the root user or by issuing the command su in the terminal and giving the root password
2. Create a global java directory by issuing the following command mkdir /usr/java
3. Copy the jdk-<version>-linux-i586.bin from its current destination to the /usr/java destination by issuing the command cp jdk-<version>-linux-i586.bin /usr/java
4. Change the execution permission of the package by navigating to the package destination and issuing the following command in the terminal chmod +x jdk-<version>-linux-i586.bin.This allows the package to be executed
5. Now extract the package contents by issuing the following command ./jdk-<version>-linux-i586.bin you will find that now you have /usr/java/jdk<version>
6. Open the /etc/profile by any text editor and add the following lines
JAVA_HOME=/usr/java/jdk<version>
PATH=$JAVA_HOME/bin:$PATH
CLASSPATH=.
export JAVA_HOME PATH CLASSPATH
and close the editor
7. Reload the /etc/profile environment variables by issuing the command source /etc/profile
8. Now issue the java -version command and you will find that you're using the jdk you've just installed
If you will download the rpm.bin package
If your Linux platoform supports the installation of rpm packages get the jdk-<version>-linux-i586-rpm.bin package
1. Get the root permissions by logging as the root user or by issuing the command su in the terminal and giving the root password
2. Change the execution permission of the package by navigating to the package destination and issuing the following command in the terminal chmod +x jdk-<version>-linux-i586-rpm.bin. This allows the package to be executed
3. Issue the following command ./ jdk-<version>-linux-i586-rpm.bin. The rpm will be extracted and the jdk will be installed. You can safely delete the extracted rpm after the finishing the installation of the jdk. Notice that you will find that the rpm created a directory named /usr/java that includes three sub-directories jdk<version> , default and latest
4. Check the installed version of java by issuing the following command java -version. If it doesn't map the jdk version you installed then follow the next step
5. Open the /etc/profile by any text editor and add the following lines
JAVA_HOME=/usr/java/latest or JAVA_HOME=/usr/java/jdk<version>
PATH=$JAVA_HOME/bin:$PATH
CLASSPATH=.
export JAVA_HOME PATH CLASSPATH
and close the editor
6. Now reload the /etc/profile environment variables by issuing the command source /etc/profile
7. Issue the java -version command again and you will find that you're using the jdk you've just installed
please feel free to post your comments and tell us if you faced any difficulties when installing the jdk
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment