Explore Courses Blog Tutorials Interview Questions
0 votes
in Java by (13.1k points)
I was trying to install JDK on my Ubuntu Server, but was not able to do that. Can anyone help me with this?

1 Answer

0 votes
by (26.7k points)

In able to install JDK in Ubuntu, follow these steps:

1. Open terminal.

2. Update the repository using these commands:

sudo add-apt-repository ppa:openjdk-r/ppa  # only Ubuntu 17.4 and earlier

sudo apt update

3. After that, install the version which you want, using these commands:

sudo apt install openjdk-8-jdk

sudo apt install openjdk-8-source #this is optional, the jdk source code

4. In able to set JAVA_HOME, use this command with your installation path:

export JAVA_HOME=/usr/lib/jvm/java-8-openjdk

5. For setting up path, try the below command:

export PATH=$PATH:$JAVA_HOME/bin

6. Once done, you can check the version:

java -version

I hope this will help.

Want to become a Java expert? join Java Certification now!!

Want to know more about Java? Watch this video on Java Tutorial For Beginners:

Related questions

0 votes
1 answer
0 votes
1 answer
asked Mar 24, 2021 in Java by dante07 (13.1k points)
0 votes
1 answer
0 votes
1 answer
+6 votes
2 answers

Browse Categories