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: 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:
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:
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.
Now, configure it will not generate any warning now.