MATLAB: Matlab hangs when closing/exiting on Ubuntu 16.10

hangsjvmMATLABmatlab guiUbuntuubuntu 16.10

I can start and use Matlab with no problem, except when trying to exit. When I hit the close button on the top right corner or type the exit command, Matlab hangs. I have to manually kill the process. No problems exiting when starting matlab without jvm.
Is there any fix or workaround to this problem?
I am currently using Xubuntu 16.10 and Matlab 2016b (student license).
$ uname -a
Linux smallhead 4.8.0-34-generic #36-Ubuntu SMP Wed Dec 21 17:24:18 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

Best Answer

This crash may be related to an issue with the graphics drivers. You may be able to resolve this problem by running the following command in MATLAB:
>> opengl save software
Restart MATLAB and see if the problem still persists.
If the problem still persists or you never get a MATLAB command prompt at all, check to make sure that your user account has access to a home directory.
If your account is using symbolic links to point to a home directory, remove them and grant access to an actual home directory and the issue should be resolved.