In previous article we saw What is Java? Where and Why to use Java? And features of Java programming language. In this particular article we will see how to setup Java environment in local machine.
Install Java and Environment Setup on Windows
To start coding in Java one has to install JDK(Java Development Kit for Windows) and setup environment. To Install Java and environment setup on Windows machines follow the steps listed below:
1) Download appropriate JDK(32-bit or 64-bit) from Oracle?s Official Site, Download Java.
2) It?s a simple executable file, double click on it and follow the instruction. It?s a simple wizard just like any other windows application install.
3) Once installed you have to set the installation directory path, so that the sytem can know about java installation.
4) Go through the java installation directory it should look like ?C:\Program Files\Java\jdk1.7.0_71\bin?. Please make sure you have to copy path through ?bin? that too of jdk nor jre.
5) Done, now go to your command line and type following:
If everythong went right, you will see something like this on screen:
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)
Done. That?s is you are done with Java installation on your windows machine.
Install Java and Environment Setup on (Linux & Unix)
Based on your version of Linux machine and preferences,there are many ways to install and setup java on linux. Here are 2 major techiniques listed, Installation can be performed using either of the followin :
(A) Install Java on 32-bit/64-bit Linux Platforms using tar.gz zipped file
Download the appropriate tar.gz(32-bit or 64-bit) file from Oracle?s official site, , Download Java
Change directory to the location where you would like the JDK to be installed, then move the downloaded .tar.gz archive file to the current directory.
Unpack the tar.gz file using following command: tar zxvf jdk-8uversion-linux-x64.tar.gz.
The Java Development Kit files are extracted and installed in a directory called jdk1.8.0_version in the current directory.
Done, you are donw with installing Java on Linux 32/64 bit machine.
(B) Install Java on 32-bit/64-bit Linux Platforms using rpm package
This techniques installs a java development kit and related file on a linux environment with the help of a .rpm extention file. This method is prefered basically on RedHat and Fedora like OS. The installer user must be a super user to install the package at root.
Download the appropriate .rpm(32-bit or 64-bit) package from Oracle?s official site, , Download Java
Make sure you are acting as super user for the machine, arternatively you can move to super user by appling su and that password.
Before installing a fresh Java its better to remove and uninstall any other old installation from the sytem, apply following command to do so:
# rpm -e package_name
Now install newly downloaded .rpm package by appling folllowing command:
# rpm -ivh downloaded_rpm_package
Done, you are done with installing Java on Linux 32/64 bit machine.
Install Java and Environment Setup on MAC OS
Download the appropriate .dmg(32-bit or 64-bit) package from Oracle?s official site, , Download Java
Double click in the downloaded .dmg file a installation box will pop up, double click on icon to install app.
Next a introduction winow will open, simply press continue to go to next level.
Now a installation window will open, click on install .
If everything goes right a final window showing ?Installer is trying to install new software? will apeear.
You will need to enter your system username and password in the installation window, click install sofware.
Done, you are done with installing Java on MAC machine.
No matters what OS you are using, just install the appropriate JDK as explained above and you are up for start coding in Java.Please note that JRE is a part of JDK so it?s installed automatically along with JDK installation.