Back
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?
sudo apt-get install openjdk-8-jdk
bin
Do the following steps:
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).
Now type sudo updatedb and press Enter to update your database.
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.
In the above step, you have to look for the location where java is installed to set the Java_Home path
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.
Type echo “JAVA_HOME=the path where java is installed” to see if it is set or not
Type echo “JAVA_HOME=the path where java is installed” >> /etc/environment to add the Java_Home path permanently.
Now restart your machine and you are good to go.
Interested to learn Java? check out the Java course from Intellipaat.
31k questions
32.8k answers
501 comments
693 users