Skip to Main Content Skip to Search
Accelerating the pace of engineering and science

Why does MATLAB hang or return a NullPointer exception while trying to save a file in the MATLAB Editor/Debugger?


Date Last Modified: Friday, June 26, 2009
Solution ID:   1-1BT28
Product:   MATLAB
Reported in Release:   R14Prerelease
Fixed in Release:   R14SP1
Platform:   Windows
Operating System:   Windows Any
 

Subject:

Why does MATLAB hang or return a NullPointer exception while trying to save a file in the MATLAB Editor/Debugger?

Problem Description:

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)

Solution:

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.

Please provide feedback to help us improve this Solution
Contact support