Hot questions for Using Ubuntu in matlab


I recently installed Matlab 2014b on a Packard Bell LJ65 laptop with Ubuntu 14.04, and every time I open it the following error pops up on the command: X11GLXDrawableFactory - Could not initialize shared resources for :0
        at jogamp.opengl.x11.glx.X11GLXDrawableFactory$SharedResourceImplementation.createSharedResource(
        at Source)
    Caused by: Startup Class Loader-SharedResourceRunner: Error making temp context(1) current: display 0x7f53a421e050, context 0x7f53a4247610, drawable X11OnscreenGLXDrawable[Realized true,
        Factory   jogamp.opengl.x11.glx.X11GLXDrawableFactory@4c932b8e,
        Handle    0x6800002,
        Surface   WrappedSurface[ displayHandle 0x7f53a421e050
    , surfaceHandle 0x6800002
    , size 64x64
    , X11GLXGraphicsConfiguration[X11GraphicsScreen[X11GraphicsDevice[type .x11, connection :0, unitID 0, handle 0x7f53a421e050, owner true, ResourceToolkitLock[obj 0x52109ee8, isOwner true, <4130bb6f, 666195d8>[count 2, qsz 0, owner <Startup Class Loader-SharedResourceRunner>]]], idx 0], visualID 0x221, fbConfigID 0xbb,
        requested GLCaps[rgba 8/8/8/0, opaque, accum-rgba 0/0/0/0, dp/st/ms 16/0/0, dbl, mono  , hw, GLProfile[GL2/GL2.sw], on-scr[.]],
        chosen    GLCaps[glx vid 0x221, fbc 0xbb: rgba 8/8/8/0, opaque, accum-rgba 0/0/0/0, dp/st/ms 24/0/0, dbl, mono  , hw, GLProfile[GL2/GL2.sw], on-scr[.]]]
    , surfaceLock <10b4cc6b, 4dd88d5e>[count 1, qsz 0, owner <Startup Class Loader-SharedResourceRunner>]
    , X11DummyUpstreamSurfaceHook[ 64x64]
    , upstreamSurface false ]]
        at jogamp.opengl.x11.glx.X11GLXContext.createImpl(
        at jogamp.opengl.GLContextImpl.makeCurrentWithinLock(
        at jogamp.opengl.GLContextImpl.makeCurrent(
        at jogamp.opengl.GLContextImpl.makeCurrent(
        at jogamp.opengl.x11.glx.X11GLXDrawableFactory$SharedResourceImplementation.createSharedResource(
        ... 2 more

I thought I could ignore it, since the program runs as normal for most of the tasks. But, when trying to plot, the following error appears:

Exception in thread "AWT-EventQueue-0" Profile GL_DEFAULT is not available on X11GraphicsDevice[type .x11, connection :0, unitID 0, handle 0x0, owner false, ResourceToolkitLock[obj 0x6860dc76, isOwner false, <2f29fc83, 6d8114a5>[count 0, qsz 0, owner <NULL>]]], but: []
    at com.mathworks.hg.peer.JavaSceneServerPeer.getCaps(
    at com.mathworks.hg.peer.JavaSceneServerPeer.doCreateCanvas(
    at com.mathworks.hg.peer.JavaSceneServerPeer.access$200(
    at com.mathworks.hg.peer.JavaSceneServerPeer$
    at java.awt.event.InvocationEvent.dispatch(Unknown Source)
    at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    at java.awt.EventQueue.access$200(Unknown Source)
    at java.awt.EventQueue$ Source)
    at java.awt.EventQueue$ Source)
    at Method)
    at$1.doIntersectionPrivilege(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at Source)

and no plot is produced.

I searched and found many problems with javax but not this one exactly. Any suggestions?

EDIT: There is also an error appearing when loading matlab from the terminal

libGL error: unable to load driver:
libGL error: driver pointer missing
libGL error: failed to load driver: nouveau
libGL error: unable to load driver:
libGL error: failed to load driver: swrast


I managed to solve it on my own following what was suggested in

basically, first download this set of drivers:


Then unpack it with:

rpm2cpio mesa-dri-drivers-8.0.5-1.el6.elrepo.x86_64.rpm | cpio -idmv

(if rpm2cpio is not installed then sudo get-apt rpm2cpio)

and copy the file in WhereEverYouUnpacked/usr/lib64/dri/ to /usr/lib/dri/

Note that the copying into /usr/ has to be done as root


While attempting to start Matlab R2013b in Ubuntu, I get the following dialog box with an error message and Matlab crashes and closes. Can someone explain the error and how to rectify it?


This is a known JDK bug. It is addressed in this question pretty thoroughly from the java perspective.

When it comes to Matlab, you options seem to be (apart from upgrading Matlab and/or OS):

  1. Add the following JVM startup option through java.opts file:


  2. Use a different java version by setting MATLAB_JAVA environmental variable. It may result in all sorts of side-effects, depending on which Matlab / Java combination you end up using.


I want to open Matlab without cd /usr/local/MATLAB/R2015b/bin and the sudo ./matlab.

So I sudo gedit ~/.bashrc and write the following commands in the ending:

export MATLAB_ROOT="/usr/local/MATLAB/R2015b/bin"

if [ -d "${MATLAB_ROOT}" ]; then
   export PATH="${PATH}:${MATLAB_ROOT}"

After source ~/.bashrc and I use echo $PATH to see that the path of matlab does exist. But when I use matlab to open the it, it will be stuck at Picked up JAVA_TOOL_OPTIONS: whereas cd /usr/local/MATLAB/R2015b/bin and the sudo ./matlab commands work well.

And if I directly use sudo ./matlab, it will show sudoļ¼š./matlab: command not found

Other information: which java shows /usr/bin/java

unset JAVA_TOOL_OPTIONS will cause another error.


Oh, I found the problem, I use the command JAVA_TOOL_OPTIONS=/usr/local/MATLAB/R2015b/bin or unset JAVA_TOOL_OPTIONS, and then get the error as follows.

It makes me recall the sudo command, so it might be a problem of permission right. Since I have to open Matlab without leaving that directory, I use ln -s /usr/local/MATLAB/R2015b/bin/matlab /path/to/your/current and then sudo ./matlab. It works.

But how to really solve this problem remains unknown. The other methods I saw like sudo apt-get remove jayatana and sudo rm /usr/share/upstart/sessions/jayatana.conf may cause unpredictable result, so I could not try them.