I am trying to install Matlab 2012a (64-bit) in Ubuntu 12.04LTS (64-bit). I have installed Java 7. My Java version is:

sabyasachi@sabyasachi-ubuntu:~/Downloads/R2012a_UNIX$ java -version
java version "1.7.0_05"
Java(TM) SE Runtime Environment (build 1.7.0_05-b05)
Java HotSpot(TM) 64-Bit Server VM (build 23.1-b03, mixed mode

I am getting the following error while installing Matlab:

sabyasachi@sabyasachi-ubuntu:~/Downloads/R2012a_UNIX$ ./install 
Preparing installation files ...
Installing ...
/tmp/mathworks_18824/sys/java/jre/glnxa64/jre/bin/java: error while loading shared libraries: libjli.so: cannot open shared object file: No such file or directory

How can I fix this problem?

When I use -v (verbose) option I am getting the following:

sabyasachi@sabyasachi-ubuntu:~/Downloads/R2012a_UNIX$ sudo ./install -v
Preparing installation files ...
->  DVD                 = /home/sabyasachi/Downloads/R2012a_UNIX
->  ARCH                = glnxa64
->  DISPLAY             = :0
->  TESTONLY            = 0
->  JRE_LOC             = /tmp/mathworks_26521/sys/java/jre/glnxa64/jre
->  LD_LIBRARY_PATH     = /tmp/mathworks_26521/bin/glnxa64

Command to run:
/tmp/mathworks_26521/sys/java/jre/glnxa64/jre/bin/java  -splash:"/home/sabyasachi/Downloads/R2012a_UNIX/java/splash.png" -Djava.ext.dirs=/tmp/mathworks_26521/sys/java/jre/glnxa64/jre/lib/ext:/tmp/mathworks_26521/java/jar:/tmp/mathworks_26521/java/jarext:/tmp/mathworks_26521/java/jarext/axis2/:/tmp/mathworks_26521/java/jarext/guice/:/tmp/mathworks_26521/java/jarext/webservices/ com/mathworks/professionalinstaller/Launcher -root "/home/sabyasachi/Downloads/R2012a_UNIX" -tmpdir "/tmp/mathworks_26521" 

Installing ...
/tmp/mathworks_26521/sys/java/jre/glnxa64/jre/bin/java: error while loading shared libraries: libjli.so: cannot open shared object file: No such file or directory
  • What is the outpuit from: sudo update-alternatives --config java ? – david6 Jun 17 '12 at 6:27
  • There are 3 choices for the alternative java (providing /usr/bin/java). Selection Path Priority Status --------------------------------------------------------- * 0 /usr/lib/jvm/java-7-oracle/jre/bin/java 1053 auto mode 1 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1051 manual mode 2 /usr/lib/jvm/java-7-oracle/bin/java 1052 manual mode 3 /usr/lib/jvm/java-7-oracle/jre/bin/java 1053 manual mode Press enter to keep the current choice[*], or type selection number: – Sabyasachi Jun 20 '12 at 22:21
  • Hi Sachi, did you finally install Matlab? If so, please consider adding your own answer. If not, please provide additional info or consider deleting this question. – ish Aug 18 '12 at 10:21

I had the same problem and was able to fix it with following steps. Open terminal Ctrl+Alt+T and run following command.

  1. Install JRE if you don't have it already.

    sudo apt-get install openjdk-7-jre
  2. Invoke the installer with -javadir option

    sudo ./install -javadir  /usr/lib/jvm/java-7-openjdk-amd64/jre
  • this works for debian too. kudos for the answer, saved my day. – Oeufcoque Penteano Sep 14 '13 at 17:52

Your Java/JRE probably has nothing to do with this - Matlab is using it's own JRE and that's what's giving you the error (notice the path).

  • Make sure Matlab's java is executable, with chmod +x sys/java/jre/glnxa64/jre/bin/java from the top-level folder (which appears to be ~Downloads/R2012a_UNIX for you) [source]

  • Run the installer with:

    sudo ./install -v
  • This should most probably work; if not, please edit your question with the extended output the verbose (-v) option will give you.


As noted, MATLAB has its own (greatly out of date) copy of the JRE, but you can make it use another simply by pointing the MATLAB_JAVA environment variable to the directory containing the JRE you want it to use.

Be aware that Matlab is not compatible with Java 7 (at the moment at least).

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.