Thursday, May 10, 2007

Matlab R2007b ugly bug

Just installed the latest Matlab software on my Slackware 11 PC and after using it for less than 120 seconds it crashed. I tried to replicate the conditions under which matlab crashed and it was really easy. In matlab's main window in the menu I went to File->Preferences... and in the Preferences window just pressing Fonts in the left navigation bar was enough to crash Matlab.

It must have been a java related thing, because I managed to fix it by just updating matlab's java jre. OK, well here is a solution:

  1. Download java's latest jre and select the Linux (self-extracting file).
  2. Extract the jre: "sh jre-6u1-linux-i586.bin". This will create a jre1.6.0_01 directory. I did not want to update slackware's java. I leave mr. Volkerding to do that for me :). Matlab comes with a local copy of jre and this is what is used by default unless the MATLAB_JAVA enviromental variable is set to point to an external jre directory when $MATLAB_ROOT/bin/matlab script is executed. The matlab's local copy of java is under $MATLAB_ROOT/sys/java/jre/glnx86, at least for the linux x86 version.
  3. I copied the jre1.6.0_01 directory there and updated the jre.cfg file of the directory with the new jre version "echo jre1.6.0_01 > jre.cfg". The old version was 1.5.0.
  4. I also removed the old jre directory: jre1.5.0 but this is optional.
After this everything worked fine.
Happy "Matlabing"

2 comments:

Anonymous said...

Thanks a lot. I wonder why they ship it with a jre if its broken...

Magdalena

Nikos Skalkotos said...

That's a good question. The newer matlab releases work just fine out of the box.