How to Set JAVA_HOME Environment Path in Ubuntu
Today’s tutorial will look at how to set the Java environment path in Ubuntu. Ubuntu installs openjdk6
to /usr/lib/jvm/java-6-openjdk
path.
Therefore, the bin
will be in your system’s directory /usr/lib/jvm/java-6-openjdk/bin
. In most cases, the java
and other associated executables have their classpath
automatically configured.
Set JAVA_HOME
Environment Path in Ubuntu
If you are starting, we suggest you use Bash rather than other shells. To open Bash, all you have to do is type in bash
.
-
First, open the file named
.bash_profile
by logging into your account.$ vi ~/.bash_profile
-
Use the following syntax to set the
JAVA_HOME
environment variable:export JAVA_HOME=path-to-java>
. You need to change your path to the following if it is now set to/usr/java/jdk1.5.0 07/bin/java
.export JAVA_HOME=/usr/java/jdk1.5.0_07/bin/java
-
Add the following to set
Path
.export PATH=$PATH:/usr/java/jdk1.5.0_07/bin
Simply entering
export
will confirm that thepaths
are correct.
-
Make sure you save your changes and then close the file. Log out of your account and then log in to view the updated information.
-
Alternately, you can activate the updated path settings immediately by typing the command that is shown below.
$ . ~/.bash_profile
-
Use the following to validate your updated configuration.
$ echo $JAVA_HOME $ echo $PATH
I have been working as a Flutter app developer for a year now. Firebase and SQLite have been crucial in the development of my android apps. I have experience with C#, Windows Form Based C#, C, Java, PHP on WampServer, and HTML/CSS on MYSQL, and I have authored articles on their theory and issue solving. I'm a senior in an undergraduate program for a bachelor's degree in Information Technology.
LinkedIn