Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (7k points)

I installed JDK in Ubuntu using the command sudo apt-get install openjdk-8-jdk , after the installation where's the Java bin directory located? And how can I set the environment path for that directory?

1 Answer

0 votes
by (13.1k points)

Do the following steps:

  1. Open terminal by pressing ctrl+Alt+T and write the command sudo su and type password when prompted to get root access(it is like admin access in windows).

  2. Now type sudo updatedb and press Enter to update your database.

  3. Type locate openjdk and press Enter to identify where java is installed in your machine. If you cannot find it then java is not installed on your machine, type sudo apt-get install openjdk-8-jre-headless -y and press Enter to install java in your machine.

  4. In the above step, you have to look for the location where java is installed to set the Java_Home path

  5. Type export JAVA_HOME=the path where java is installed. This would set the Java_Home path you want but it is temporary, it would be lost when your system is restarted.

  6. Type echo “JAVA_HOME=the path where java is installed” to see if it is set or not

  7. Type echo “JAVA_HOME=the path where java is installed”  >> /etc/environment to add the Java_Home path permanently.

  8. Now restart your machine and you are good to go. 

Interested to learn Java? check out the Java course from Intellipaat.

Related questions

0 votes
1 answer
+1 vote
1 answer
asked Aug 1, 2019 in Java by Sammy (47.6k points)
0 votes
1 answer

Browse Categories

...