Java is very popular Programming language everywhere in the world. There are many IDEs developed for running java programs such as Netbeans, Eclipse, Dr.Java and etc. Having just an IDE is not enough to run java programs in Linux or any other OS. JDK is needed to be installed in a  computer to be able to run java programs. How to configure it in Ubuntu? There are so many ways in the internet to do this task. But this is the easiest and the best way to install JDK that according to my point of view. Here, I recommend to install Oracle JDK via Ubuntu PPA. Follow these steps. Be sure to connect your PC to internet.

1. Open the terminal and type this command.

          
sudo add-apt-repository ppa:webupd8team/java

Type in your password when it asks and hit Enter.



2. Run following commands to update system package index and install Java.    
  

sudo apt update; sudo apt install oracle-java8-installer

3. While Installation is going you will ask for Java license. Select OK and Enter.





4. To check whether Java is installed or not, type this command in your terminal.


javac -version

You will get an output like this.





5. Now Java is installed. We have to set  Java environment variables. For that, type this command.


sudo apt install oracle-java8-set-default

Then type javac in the terminal to confirm your installation is done; if you want. Then you will get a long description in the terminal like  this.






You can run Java programs now, through the terminal or an IDE like Netbeans.

0 Comments