Installation on Ubuntu
1. Configure Proxy
Setting for Proxy Server
$ sudo gedit /etc/apt/apt.conf
[Add the following lines]
Acquire::http::Proxy
"http://user-id:password@proxy-address:port ";
Acquire::https::Proxy "https://user-id:password@proxy-address:port";
Acquire::ftp::Proxy
"ftp://user-id:password@proxy-address:port ";
2. Update the Ubuntu,
if not updated
$ sudo apt-get update
3. Verifying Java Installation, if it is already installed or not
$ java -version
[If Java is already, installed on system, it gives
the response somewhat like below for java-7 –
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b13)
Java HotSpot(TM) Client VM (build 25.0-b02, mixed
mode)
In case Java is not installed, then Install Java with following command.]
$ sudo apt-get install
openjdk-7-jdk
4. Edit ~/.bashrc file by adding java path
$ sudo gedit ~/.bashrc
[Add the following line to ~/.bashrc file. It means adding the location to the PATH variable]
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
export PATH==$PATH:$JAVA_HOME/bin
5. Reload the changed ~/.bashrc settings
$ source $HOME/.bashrc
Installation on Window
1. Download JDK
Download the latest and compatible version of JDK from the below link
2. Install the downloaded exe file
Double
click on exe file, it will be installed silently.
If you are saving the java source file inside the C:\Program Files\Java\jdk1.8.0_121\bin directory, path is not required to be set because all the tools will be available in the current directory.
But, if you are having your java file outside the C:\Program Files\Java\jdk1.8.0_121\bin folder, it is necessary to set path of JDK. Path can be set in two ways: temporary and permanent.
3.1 Setting up Temporary Path
Follow the following steps:
Open a Windows command prompt (Windows key + R -> enter cmd -> OK). Write following command in command prompt. For different version of jdk or different location, copy the path of jdk/bin directory (your JDK installation path may be different).
> set path= C:\Program Files\Java\jdk1.8.0_121\bin
3.2 Setting up Permanent Path
Follow the following steps:
Right-click on Computer -> Properties -> Advanced system settings; then in the Advanced tab, click Environment Variables... -> System variables -> New....
Give the new system variable the name JAVA_HOME and the value value C:\Program Files\Java\jdk1.8.0_121 (depending on your JDK installation path it varies).
Then select the Path system variable and click Edit.... Keep the variable name as Path, and append C:\Program Files\Java\jdk1.7.0_79\bin; or %JAVA_HOME%\bin; (both mean the same) to the variable value. Do not delete any content already present there in the value of path.
The same procedure can be repeated for the user variables (Computer -> Properties -> Advanced system settings; then in the Advanced tab, click Environment Variables... -> User variables).
Open a Windows command prompt (Windows key + R -> enter cmd -> OK), and check the following:
> java -version
> javac –version
IDE/Editors for JAVA
For writing Java codes, a text editor is required. Note
pad is most basic but some sophisticated IDEs (Integrated development
environment) are also available like netbeans and eclipse.
Notepad: Simple text editor inbuilt in Window OS
Notepad++: Notepad++ is a free source code editor that supports several languages can be downloaded from https://notepad-plus-plus.org/
Netbeans: A Java IDE that is open-source and free which can be downloaded from https://www.netbeans.org/index.html
Eclipse: A Java IDE developed by the eclipse open-source community and can be downloaded from https://www.eclipse.org/