MATLAB Answers


Java Update and Guide Command

Latest activity Commented on by Leonard Weiß on 1 Feb 2016
After the last update of Java on my laptop, I have been facing a problem in GUI Layout toolbox. I have written a GUI program in matlab whose controls are mostly defined and initialized in the code. Thus I have a few number of controls when I open the figure using the command "guide". When I run the application, it is executed properly like before. But when I want to open the figure using the "guide" command, I receive the following error:
java.lang.ClassCastException: [D cannot be cast to [Ljava.lang.String;
at com.mathworks.jmi.MatlabWorker$
at com.mathworks.jmi.MatlabWorker.start(
Moreover this error message pops up as well:
Surprisingly Matlab complains just about this very program. I will not receive any error, if I run "guide" command for other GUI programs.


Sign in to comment.

1 Answer

Answer by Cam Salzberger on 2 Sep 2015
Edited by Cam Salzberger on 2 Sep 2015

Hello Seyedali,
I understand that you created a GUI using the third-party GUI Layout Toolbox, and it now crashes GUIDE after your recent Java update. There are a few potential sources of the issue. For issues like this, it is very helpful if you provide what operating system you are using, and which version of MATLAB.
This is especially important because MATLAB transitioned to a new graphics system in R2014b. There are also two versions of the GUI Layout Toolbox, one for R2014a and before, and another for R2014b and later. If you used the Layout Toolbox for the incorrect version, that could be a potential source of issues. Also, if you created the GUI in a different version of MATLAB than the one you are trying to open it in with GUIDE, that could also potentially be causing the issue.
There was a Newsgroup thread with a similar error. It was suggested that restarting the computer (to allow Java to rehash everything) might help, and also checking for any custom startup.m files. Enter the following command at the command prompt:
which -all startup
If any files are shown, check to make sure there aren't any changes you don't want being done in them. There really should only be one startup.m file, if any.
It also matters which operating system you are using, and which version of MATLAB. On a Mac, with versions R2013a and earlier, MATLAB uses the operating system's Java Virtual Machine. Later versions include their own JVM shipped with the MATLAB release, just like for Windows and Linux releases. If your MATLAB is using the shipped JVM, the Java update on your operating system should not have affected anything unless you have pointed MATLAB to use the OS' installed Java. See these Answers posts for more information about changing which JVM MATLAB uses for Windows, Mac, and Linux.
If none of these situations seem to apply, I would suggest making a very simple GUI using the GUI Layout Toolbox, and see if that still causes the issue with GUIDE. If it does, I would suggest contacting the creator of the toolbox. If the simple GUI does not cause the issue, you could try deleting features from your original GUI (using the Layout Toolbox) one at a time until the issue does not occur, to narrow down which uicontrol(s) or feature(s) caused the issue.
I hope this helps point you in the right direction!


Hello dear Cam,
Thank you for your detailed answer. The OS is Window 7 Enterprise 64-bit. The Matlab version which I am using is (R2015a). The original code and figure were created in the older versions of Matlab. But I changed almost everything in the primitive program in R2015a environment and it used to work properly for quite a long time after transferring the code to R2015a.
I was suggested by one your colleagues (to whom I sent the FIG-file) to use a FIG-file from my previous backups. He claimed that the problem occured because I have saved the figure while the code was running and it has nothing to do with the Java update.
Thank you again.
Hallo, I do the same mistake. Is it possible to open that GUI in the guide again or I need to creat a new?
Thanks Leo

Sign in to comment.