How to fix Java problem installing Matlab 2012a (64-bit) in Ubuntu 12.04 (64 bit)?

Solution 1:

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
    

Solution 2:

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.

Solution 3:

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).