3

When I run MATLAB install script in Ubuntu, I get the following exception:

Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class java.awt.Component

longer output is available here

I know that it's a Java problem and could potentially be fixed by changing the classpath or something like that but I don't exactly know how.

Any Ideas?

6
  • Are you trying to install remotely? Commented May 22, 2012 at 2:29
  • That's true. I ssh to the server that I have previously copied the contents of the MATLAB DVD to. Then I run install script on the server. Commented May 22, 2012 at 7:14
  • There you go then - it's trying to run the GUI installer (via Java) but it can't instantiate anything because there's no display. Try to install it via command line only. Commented May 22, 2012 at 8:07
  • The thing is that I ssh with -X enabled. So I should have X. Commented May 22, 2012 at 16:59
  • How can I install without the GUI? Commented May 22, 2012 at 17:00

4 Answers 4

7

For me this error was fixed when I installed the JRE on my system:

apt-get install default-jre

on Ubuntu 12.04, instead of having MATLAB use its own.

Sign up to request clarification or add additional context in comments.

2 Comments

Worked for me. I tired other stuff first. Surely I didnt need all of it, never mind.
7 years later, this worked for me. After 3 hours of pulling my hair.
2

I've been battling this problem for the whole evening as well but I stumbled onto a solution that works for me at least.

After trying to install using the silent installer I got a different error with a bit more information. It turned out that a library was missing (libXtst.so.6). I was able to install that on my Ubuntu system with:

apt-get install libxtst6

After that I tried running the GUI installer (over X forwarding) and it looks like it's going to work now.

Comments

1

For MATLAB R2012a Student Edition, in Ubuntu 14.04, I had to install these prerequisites first:

sudo apt-get install default-jre libxtst6:i386 libXext6:i386 libxi6:i386 libncurses5:i386 libxt6:i386 libxpm4:i386 libxmu6:i386 libxp6:i386

Next I installed/activated per MATLAB's instructions (sudo ./install). I answered "yes" when the installer asked to add a symbolic link in /usr/local/bin/

Finally, when launching MATLAB, I have to specify that it run in 32-bit mode:

matlab -glnx86

I assembled those steps from this answer: https://askubuntu.com/questions/363878/how-to-install-32-bit-matlab-in-ubuntu-64-bit

and the Ubuntu MATLAB guide: https://help.ubuntu.com/community/MATLAB

Optional

I didn't want to type the -glnx86 option each time I launch MATLAB, so I replaced the matlab symbolic link in /usr/local/bin/ with a script that automatically specifies the -glnx86 option:

ls -l /usr/local/bin/matlab #note the destination of the symbolic link
sudo mv /usr/local/bin/matlab /usr/local/bin/matlab.bak
#ensure the first path below matches your symbolic link's destination
echo '/usr/local/MATLAB/R2012a_Student/bin/matlab -glnx86  "$@"' | sudo tee /usr/local/bin/matlab
sudo chmod +x /usr/local/bin/matlab

With that, I can type 'matlab' and it launches properly. (The "$@" in the script forwards all input arguments to matlab.) There's probably a more elegant way to accomplish this, but it worked.

I also encountered a "/lib/libc.so.6: not found" error on matlab startup, which I fixed by following this answer.

Comments

0

Installing gnome (sudo apt-get install gnome) fixed this problem for me. I'm sure this was total overkill, but the required libraries are now available.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.