Wednesday, August 9, 2017

The JAVA path problem of the MATLAB installation

The JAVA path problem of the MATLAB installation


The below message shows an error, suggesting that MATLAB cannot find Java library.

Warning: Unable to find Java library: /usr/local/java/jdk1.7.0_17/jre/lib/rt.jar/lib/i386/libjava.so
Please check if you have a MATLAB_JAVA environment variable.
Note that MATLAB requires Java version 1.4 or higher.
Warning: Disabling Java support
The solution is to direct the MATLAB java environment path to the folder that comes together with the MATLAB installation, instead of the one installed in the system. Here is how to do it.

yslin@yslin-Ubu2G:~/MATLAB$ export MATLAB_JAVA=/home/yslin/MATLAB/R2011a_Student/sys/java/jre/glnx86/jre
yslin@yslin-Ubu2G:~/MATLAB$ echo MATLAB_JAVA
Firstly, you need to find where your MATLAB installation is. I installed it on my home folder, rather than in the system (i.e., under the root "/"), so I located it under the folder, ~/MATLAB/R2011a_Student/sys/java/jre/glnx86/jre. The second step just to check, using "echo", if the environment variable, MATLAB_JAVA, has been exported successfully.

download file now