View Full Version : Solution for Compiz + Matlab. Unable to render java correctly or even launch Matlab
Breathe
December 8th, 2007, 01:51 PM
*********************************** COMPIZ + BERYL ***************************************
This solution is for those who have tried adding an environment variable with the next command before executing matlab with no results.
The old-school solution
For those, who still don't know what the hell I'm saying... let me explain. Matlab hates Compiz Fusion and Beryl... xD The problem is that Matlab starts but it doesn't show anything in the window, only a blank screen with a window border (If you mess around with your mouse over the screen you'll see the matlab messages when you cross over an icon). Some people seem to have solved this problem opening a terminal and writing the next code before they run matlab.
$ export AWT_TOOLKIT==MToolkit
$ matlab
NOTE: If this works for you and solves your problem make the environment variable auto-set on start-up
$ sudo gedit /etc/environment
Add the string "export AWT_TOOLKIT==MToolkit" to this file and restart
The new solution
I've been playing around with matlab bin file and searching through the web and found that using the next piece of code just after the "#!/bin/sh" command of your matlab bin file the problem is solved and you don't need the "export" thing
export MATLAB_JAVA=/usr/lib/jvm/java-6-sun/jre/
The result after editing the file would be something like this...
#!/bin/sh
export MATLAB_JAVA=/usr/lib/jvm/java-6-sun/jre/
#
# Name:
# matlab script file for invoking MATLAB
#
bla bla bla
Save and run matlab... ;)
Hope this works for all...
rambomedic
December 19th, 2007, 03:49 PM
Woohoo! Thank you! So many other solutions claimed to work, but both of yours worked flawlessly.
Good job!
urosh2
December 21st, 2007, 06:27 PM
It works for me when i do it in a console. But when i tried to use my batch file program doesn't run, it dissapears in one second. I created a new document matlab.sh
#!/bin/sh
export MATLAB_JAVA=/usr/lib/jvm/java-6-sun/jre/
#
# Name:
# matlab script file for invoking MATLAB
#
/media/sda3/matlab/bin/matlab
thank you for help
turboxs
January 9th, 2008, 03:47 AM
Thanks ! Was unable to get "old school solution" to work but your solution worked like a charm for Matlab version 7.3.0 (R2006b) on 7.10 with Compiz fusion.
davis152
January 25th, 2008, 03:13 PM
Worked for me too on 7.10 with Compiz fusion and Matlab 7.5 (2007b). The old school solution was working (I could see and use Matlab), but I had other strange problems with window focus. For example, if I ran a script that generated a plot and then switched back to the main window, it would not accept keyboard input. I'd have to select a menu with the mouse, then close the menu with the Esc key before I could type again. Tab completion was also broken. The Tab key would bring up a list of possibilities, but I could only select from them using the mouse.
The "new school" solution has fixed all those problems. Matlab now works like it should. Thanks!
mathe
January 29th, 2008, 07:26 PM
The export AWT_TOOLKIT==MToolkit 'solution' is NOT recommended. Sure, at first it looks like a fix but I've seen the weirdest side effects, one being the keyboard focus mentioned but in general huge freeze-ups of the whole desktop. So, although interesting to hear about this possible new solution, I've had it with compiz for other reasons than matlab. Certain websites that, I assume, uses java freezes up while browsing with firefox. And then, after the initial laugh over compiz hilarious desktop effects and realization that it's a lousy human interface, the REAL solution is: TURN COMPIZ OFF, it's faster, better and rock solid.
Hopefully 8.04 will have it turned off by default for a better user experience!
RudolfMDLT
February 9th, 2008, 07:15 AM
hi,
Thanks for this! Just thought I'd add something:
Matlab works fine without compiz running. But when using this method to fix the problem of the matlab buttons not appearing, you have to install "Sun Java 6 Web Start", otherwise matlab won't start.
Why though?:confused:
Thanks for the handy post!
Rudolf
kapst0k
February 27th, 2008, 07:52 AM
Super it works great. Thanks
RudolfMDLT
March 1st, 2008, 07:58 AM
Hi,
Could some one maybe confirm this:
Using this fix "breaks" the ability of matlab to print. When I plot my graphs, and click "File"->"Print", nothing happens, and there are a lot of errors in the main command interface?
uncommenting the line entered here, allows me to print again, albeit, you have to turn compiz off.
kapst0k
March 26th, 2008, 05:59 AM
Hi,
Could some one maybe confirm this:
Using this fix "breaks" the ability of matlab to print. When I plot my graphs, and click "File"->"Print", nothing happens, and there are a lot of errors in the main command interface?
uncommenting the line entered here, allows me to print again, albeit, you have to turn compiz off.
I can confirm that. Exporting the plot (as a .jpg for instance) and printing that file works fine though.
AegisTalons
April 6th, 2008, 10:50 PM
Thanks for the help, I now have matlab working on linux.
mojoe
April 7th, 2008, 04:31 PM
The solutions above work well in case of java rendering problems, but not for the keyboard focus problem at all. By installing the newest version of java jre, this bug is solved too. (on my machine)
ubuntu 7.10
kernel: 2.6.22-14
java-installation: jdk1.6.0_05 (previous: java-6-sun-1.6.0.03)
thanks for the thread and good luck....:)
Adman
April 8th, 2008, 05:05 PM
Hi all
If I use the "old-school solution" (export AWT_TOOLKIT==MToolkit) as well as the "new-school solution" (export MATLAB_JAVA=/usr/lib/jvm/java-6-sun/jre/) in my matlab bin file I get Keyboard focus problems.
If I use only the "new-school solution", I cannot access any help files!
Can anyone help ? ;) Thanks
KosmoZ
April 18th, 2008, 06:35 AM
Pfew thanks man! I was getting really frustrated, hitting my keyboard like crazy with the 1st solution!! Now it seems to work well so far.. From now on it's fun to program in Matlab :)
Adman
April 18th, 2008, 07:12 AM
Guys,
I had the drawing of my desktop by Nautilus turned off having gone through a tutorial and how to customize the background of each side of the compiz desktop cube. I found that after re-enabling Nautilus to draw the desktop, most of my problems have gone away, including the Matlab keyboard locking!
I hope this helps!
Parksy
April 24th, 2008, 03:28 AM
The MATLAB_JAVA solution works great for me too.
As an alternative, you can add that line to /etc/bash.bashrc and avoid problems whenever Matlab is updated.
SorryGoFish
May 16th, 2008, 08:34 PM
A year later, still helping people.... thanks.
vBulletin® v3.7.4, Copyright ©2000-2008, Jelsoft Enterprises Ltd.