WARNING: JAVA_HOME environment variable not initialized – Octave Installation

While configuring octave-4.0.0, I got the following warning-

configure: WARNING: JAVA_HOME environment variable not initialized.  Auto-detection will proceed but is unreliable.
configure: NOTE: Libraries or auxiliary programs may be skipped if they are
configure: NOTE: not found OR if they are missing required features on your
configure: NOTE: system.
To solve this problem, first of check for the java version using following:
java -version

If it is not installed, use the following commands to install:

sudo apt-get install default-jre
sudo apt-get install default-jdk

Now, to set the JAVA_HOME environment variable, use the following:

sudo update-alternatives --config java

It will return the path, write that path in the file /etc/environment:

sudo vim /etc/environment

In this file, add the following line (replacing YOUR_PATH by the just copied path):


That should be enough to set the environment variable. Now reload this file:

source /etc/environment

Test it by executing:


If this returns the path you just added in the file, then you are going write.

Now, again try to ./configure the octave, if still it’s giving JAVA_HOME environment error, then try this before ./configure. Your path/shell syntax may vary. This is the closest Linux distros get to standardizing on how to determine where Java is installed.

 export JAVA_HOME=/usr/lib/jvm/default-java

Now, configure it will not generate any warning now.


Published by


I am the one who discover myself daily through reading, writing, interacting with people and expressing my thoughts to inspire them if I would be able to bring a little change to the society through my work. I write blogs, participate in various social activities and want to be a Professional Speaker. Currently, I am pursuing my post graduation in Computer Applications from Guru Nanak Dev Engineering College, Ludhiana and I’m very much active in many technical & social communities.

2 thoughts on “WARNING: JAVA_HOME environment variable not initialized – Octave Installation”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s