Monday, April 27, 2015

Running MATLAB 2012b on MAC OS X Yosemite

I have been trying to install the MATLAB 2012b on MAC OS X 10.10.3 (Yosemite), however, starting the application after installation keeps gives an error message "Unexpected Exception: There was an unexcepted exception" that refers to the path of log file with error details.





I checked what was inside the log file, and I have found the following message about the reason of the exception:


 com.mathworks.instutil.JNIException: java.lang.UnsatisfiedLinkError: Cant load library: /Applications/MATLAB_R2012b.app/bin/maci64/libinstutil.dylib  
 java.lang.UnsatisfiedLinkError: Cant load library: /Applications/MATLAB_R2012b.app/bin/maci64/libinstutil.dylib  


Doing a quick search about problems starting MATLAB on MAC OS X, I have found out that the reason might be the version of java that I am running.

I checked the version of java installed on my machine using


 java -version  
   

and the output was 
 java version "1.8.0_40"  
 Java(TM) SE Runtime Environment (build 1.8.0_40-b27)  
 Java HotSpot(TM) 64-Bit Server VM (build 25.40-b25, mixed mode)  


as I am running Oracle Java 1.8. 

I followed the instructions from this stack overflow answer, to remove the existing installation of Java 1.8 from my Mac.
sudo rm -rf /Library/Java/JavaVirtualMachines/jdk<version>.jdk
sudo rm -rf /Library/PreferencePanes/JavaControlPanel.prefPane
sudo rm -rf /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin

then I installed the Java for OS X from Apple:
https://support.apple.com/kb/dl1572?locale=en_US

Now, I tried again launching the MATLAB. I noticed that the error message have changed as now the application runs and I can view the splash screen but by the time when it is supposed to display the MATLAB desktop environment, it shows another error message instead.


The new error message is 

Error Starting Desktop:


 java.lang.NullPointerException   
  at com.mathworks.widgets.WindowsWidgetFactory$SearchAndClearButton.anyText(WindowsWidgetFactory.java:187)   
  at com.mathworks.widgets.WindowsWidgetFactory$SearchAndClearButton.getIcon(WindowsWidgetFactory.java:195)   
  at com.apple.laf.AquaButtonUI.setThemeBorder(AquaButtonUI.java:113)   
  at com.apple.laf.AquaButtonUI.installDefaults(AquaButtonUI.java:80)   
  at javax.swing.plaf.basic.BasicButtonUI.installUI(BasicButtonUI.java:88)   
  at javax.swing.JComponent.setUI(JComponent.java:664)   
  at javax.swing.AbstractButton.setUI(AbstractButton.java:1807)   
  at javax.swing.JButton.updateUI(JButton.java:146)   
  at javax.swing.AbstractButton.init(AbstractButton.java:2172)   
  at javax.swing.JButton.<init>(JButton.java:136)   


At this moment, I was able to start the MATLAB from the command line, but without the desktop GUI environment using the commands:
 sudo /Applications/MATLAB_R2012b.app/bin/matlab --nodesktop  
or 
 sudo /Applications/MATLAB_R2012b.app/bin/matlab --nojvm  

I tried installing X11 which is claimed to be required by MATLAB on OS X as stated here  but still the problem persists to happen.

Finally, I noticed that there is a bug report for this issue on MathWorks website that provides a patch for solving this issue. I downloaded the patch from https://www.mathworks.com/support/bugreports/1098655 , and  run at as described in the instruction on the page and now I can run MATLAB normally on my MAC Yosemite! :D :D



No comments:

Post a Comment