MATLAB: Does MATLAB hang or return a NullPointer exception while trying to save a file in the MATLAB Editor/Debugger

iconloadMATLAB

The following steps reproduce the hanging behavior:
1. Create a new file within the MATLAB Editor/Debugger by typing "edit x" within the MATLAB Command Window.
2. Type some text in the file.
3. Select "Save" (either by the toolbar or the menu).
This will result in the NullPointer exception being shown within the MATLAB Command Window.
java.lang.NullPointerException
at javax.swing.ImageIcon.<init>(Unknown Source)
at javax.swing.ImageIcon.<init>(Unknown Source)
at com.sun.java.swing.plaf.windows.WindowsFileChooserUI$ShortCutPanel.<init>(Unknown Source)
at com.sun.java.swing.plaf.windows.WindowsFileChooserUI.installComponents(Unknown Source)

Best Answer

This bug has been fixed for Release 14 SP1 (R14SP1). For previous releases, read below for any possible workarounds:
This is a bug in the way the "Save File" dialog box loads icons.
As a workaround, place the following command in your "startup.m" file.
com.mathworks.mwswing.MJFileChooser.setUseAWTFileDialog(1)
Note that although this bug only occurs on Windows machines, Mac users may want to use this workaround as well. It generates a more familiar window.