Neues vom Nordkap

06.02.2009 23:00

Changing Matlab's Java version

I have students version of Matlab (release 2007a) running on my laptop. It is actually the only piece of non-free software that I run. And indeed, I find their licence/company policy embarrassing. And it's plain expensive, only those students licences are cheap (ca. 70 Euros...) But still so it's a bad deal, because they are normally out-of-date releases and quite buggy. In my case I had no way to get certain frequently used characters like "^" (exponentiation) and "~" (negation) printed unless I switched to an American keyboard layout. But me, I don't now by heart where all the special characters are. So using the American layout worked but caused a lot of typos and wild character binding guessing. Not very comfortable. And then whenever I tried to edit certain features in the preferences the whole thing crashed. Until I noticed from the lots of JAVA exceptions that Matlab uses its own JRE. So I changed it to my newer Java version.
Now it works beautifully, I can browse the prefs without crashes, and I even get the "^"s and "~"s where they should be. But hey, if you ship a JRE with your program, why don't you check it's together working beforehand? It's a bit embarrassing, no?
So here is what I did:

How to change Matlabs Java version

By default Matlab ships with its one JRE, which is in (for linux 32bit)
$MATLABHOME/sys/java/jre/glnx86/jre_xx
where $MATLABHOME is your installation directory and xx stands for the Java version. In my case (release 2007a) it's Java 5. I created a link in this directory
$ cd $MATLABHOME/sys/java/jre/glnx86
$ ln -x /usr/lib/jvm/java-6-sun/jre jre1.6

Then I edited the file jre.cfg in the same directory to contain this link instead of the old version. But this is not enough. You have to set the environment variable MATLAB_JAVA. So I added the line
export MATLAB_JAVA=/usr/lib/jvm/java-6-sun/jre
in my .bashrc then open a new shell and start Matlab from it. Note that for me java-6-openjdk did not it crashed right after startup.

You might ask why I you have this "evil" software in the first place? Right. I know there is Octave to replace it, and I use that as well. The reason why I still have Matlab is that we teach courses in the Master's programme in Matlab. Oh, well this is even worse. We hook the student on to it... I totally agree, we should migrate all the material to Octave or even C (which the students are more at ease with anyway, they normally don't manage to get into the matrix/vector programming model of Octave/Matlab), but that is out of my hands.
I even had to buy the student licence for my laptop because there was no other way that I could show the programs in class.
(No, there is no University owned laptop that I could use. And no, the computers in the lab cannot be used with a projector, and no I could not login to a remote computer and run it there, because there was no network plug with a DHCP service in the computer lab at that time. I have tried it all. Uff, you are free to imagine by yourself, what I my opinion is about all this...)

Comments

No comments yet.

No backlinks yet.

Add a comment

Please leave these fields blank:

Name:
Email:
(will not be displayed unencrypted)
Comment:
No HTML allowed. URLs are not turned into hyperlinks.


You can edit this comment until 30 minutes after posting.
ich

About

My name is Magdalena Luz. I grew up in Switzerland. I studied physics at Humboldt University Berlin, where I used to live in "Nordkapstrasse" (North Cape street). That's how this blog got its name. After a short intermezzo in Copenhagen, DK, I live now in the amazing city of Wuppertal. This is a place the wild, wild West of Germany, built on 7 hills, (which is really the only thing it has in common with Rome) It is populated by the strange species of homo germanicus occidens communis, also known as 'gemeiner Wessi'. And even with her it is light years away from ever being like Berlin.

Archiv

2009
2008
2007
2006
2005
2004
2003
2002

RSS

My Recordings

Berlin

Blogplan Berlin keepitrollin.de Zitty Physics department of HUB AG COM @ HUB

KBH

Christiania dnbzone.dk Niels Bohr Institute

Blogs

Wo Sönke's Sparshow Mercedes Bunz Cosmic Variance Asymptotia Uncertain Principle Michael Nielsen
Powered by Beta-Blogger