MATLAB Answers

Error when using uigetdir() in deployed MATLAB application (java.lang​.IllegalAr​gumentExce​ption: eval requires a valid MCR id when running in standalone mode)

25 ビュー (過去 30 日間)
Nate Ellingson
Nate Ellingson 2018 年 4 月 13 日
When calling uigetdir() in a deployed application I get this error sometimes, seemingly more often than not. I can't seem to find anything about this online.It might be related to my resent switch to 2018a.
Error using matlab.ui.internal.dialog.FolderChooser/doShowDialog (line 70)
Java exception occurred:
java.lang.IllegalArgumentException: eval requires a valid MCR id when running in standalone mode.
at com.mathworks.jmi.NativeMatlab.PostMatlabMessage(Native Method)
at com.mathworks.jmi.NativeMatlab.postMatlabMessage(NativeMatlab.java:224)
at com.mathworks.jmi.NativeMatlab.postMatlabMessage(NativeMatlab.java:240)
at com.mathworks.jmi.MatlabLooper.postMatlabMessage(MatlabLooper.java:150)
at com.mathworks.jmi.MatlabMCR.postAsync(MatlabMCR.java:1542)
at com.mathworks.jmi.MatlabMCR.eval(MatlabMCR.java:518)
at com.mathworks.jmi.Matlab.eval(Matlab.java:1197)
at com.mathworks.jmi.MatlabPath$PathCallback.completed(MatlabPath.java:1449)
at com.mathworks.jmi.MatlabMCR$InterestHandler.messageReceived(MatlabMCR.java:1663)
at com.mathworks.jmi.NativeMatlab.ProcessPendingEvents(Native Method)
at com.mathworks.jmi.NativeMatlab.processPendingEvents(NativeMatlab.java:508)
at com.mathworks.jmi.AWTUtilities$MatlabLatch.safeWait(AWTUtilities.java:892)
at com.mathworks.jmi.AWTUtilities$MatlabLatch.waitFcn(AWTUtilities.java:907)
at com.mathworks.jmi.AWTUtilities$Latch.acquire(AWTUtilities.java:770)
at com.mathworks.jmi.AWTUtilities$Invoker.invoke(AWTUtilities.java:500)
at com.mathworks.jmi.AWTUtilities.invokeAndWaitInternal(AWTUtilities.java:250)
at com.mathworks.jmi.AWTUtilities.invokeAndWait(AWTUtilities.java:111)
Error in matlab.ui.internal.dialog.FolderChooser/show (line 48)
Error in uigetdir_helper (line 32)
Error in uigetdir (line 61)
Error in Settings_Window>Select_Output_Report_Callback (line 275)
Error in gui_mainfcn (line 95)
Error in Settings_Window (line 42)

  0 件のコメント

サインインしてコメントする。

採用された回答

Nate Ellingson
Nate Ellingson 2018 年 4 月 23 日
Called Mathworks, this is a known bug. They are not sure how they plan to fix it yet. It could be an update in within version 2018a, but we may have to wait for 2018b.

  1 件のコメント

Steven Lord
Steven Lord 2018 年 9 月 12 日
Copying the answer given by Stefanie Schwarz into the Accepted Answer to give it additional visibility:
This is a known bug in MATLAB R2018a. Please refer to the below Bug Report for workaround instructions: https://www.mathworks.com/support/bugreports/1729458

サインインしてコメントする。

その他の回答 (8 件)

Stefanie Schwarz
Stefanie Schwarz 2018 年 6 月 6 日
This is a known bug in MATLAB R2018a. Please refer to the below Bug Report for workaround instructions: https://www.mathworks.com/support/bugreports/1729458

  1 件のコメント

William Warriner
William Warriner 2018 年 7 月 20 日
One thing I'd caution other users who might use the workaround is that the default behavior of the built-in uigetdir is to return 0 if cancel or X is pressed (i.e. for JFileChooser.CANCEL_OPTION in the workaround).

サインインしてコメントする。


Roberto Spreafico
Roberto Spreafico 2018 年 4 月 18 日
I have the same problem with the uigetdir() function with the same Matlab version (R2018a)

  0 件のコメント

サインインしてコメントする。


Honghua Hu
Honghua Hu 2018 年 4 月 21 日
The same symptom here, after I switch to 2018a...

  1 件のコメント

Nate Ellingson
Nate Ellingson 2018 年 4 月 23 日
Called Mathworks, this is a known bug. They are not sure how they plan to fix it yet. It could be an update in within version 2018a, but we may have to wait for 2018b

サインインしてコメントする。


Marco Witte
Marco Witte 2018 年 5 月 8 日
After switching to 2018a I got the same problem. This is very annoying, especially if I think about the amount we pay each year for the maintainace Service to mathworks...

  8 件のコメント

表示 5 件の古いコメント
Nate Ellingson
Nate Ellingson 2018 年 5 月 29 日
Realized I could attach a file, place this file in your matlab path and use uigetdir like you normally would. and when a fixed version of matlab comes out simply remove this file from you matlab path.
Peter Bottelier
Peter Bottelier 2018 年 6 月 6 日
Thanks Nate. Very helpful. I too experienced the same R2018a behaviour w.r.t. built-in uigetdir.m. It's rather annoying MathWorks did not detect this during release validation testing (apparently). @MathWorks, please improve testing your basic function tests!
William Warriner
William Warriner 2018 年 7 月 20 日
Thanks Nate, helped me a bunch! One thing I'd caution other users who might download the attachment is that the default behavior of the built-in uigetdir is to return 0 if cancel or X is pressed (i.e. for JFileChooser.CANCEL_OPTION in the workaround).
I am also posting this as feedback to the bug report given below.

サインインしてコメントする。


Rohan R
Rohan R 2018 年 6 月 7 日
I see there are 3 uigetdir.m files. All the three need to be modified/replaced?
/usr/local/MATLAB/MATLAB_Runtime/v94/mcr/toolbox/matlab/connector2/shadowfiles/shadows/uigetdir/uigetdir.m /usr/local/MATLAB/MATLAB_Runtime/v94/mcr/toolbox/matlab/uitools/uigetdir.m /usr/local/MATLAB/MATLAB_Runtime/v94/mcr/toolbox/compiler/mdwas/mcr/uigetdir.m

  1 件のコメント

Nate Ellingson
Nate Ellingson 2018 年 6 月 8 日
Don't replace any of those, just place uigerdir in a place in your path higher than all of those. A good place, if your using windows, would be in your "Documents\MATLAB" folder. There probably is an equivalent in linux, but I'm not sure. This is automatically added to your path above these other instances of uigetdir.m.
If you are only working on one application, you can place my uigetdir.m in the same directory as the main file.
When Matlab get updated to fix this bug, simply remove the file that you added.
Do this before compiling the application.

サインインしてコメントする。


Victor Gonzalez
Victor Gonzalez 2018 年 7 月 13 日
This bug is marked as fixed with update 4, but in my deployed application the problem persists, the workaround is again the only "solution"

  0 件のコメント

サインインしてコメントする。


D. Plotnick
D. Plotnick 2018 年 7 月 31 日
I am also still seeing this issue with Update 4.

  2 件のコメント

Steven Lord
Steven Lord 2018 年 7 月 31 日
Updating is one part of the fix. Recompiling the application and contacting Support for the R2018a Update 4 Runtime to be installed where the application will be run are the other two pieces. Can you confirm that you have completed all three parts and still experience the bug? If so I recommend contacting Support and working with them to determine why the fix has not resolved the issue.
D. Plotnick
D. Plotnick 2018 年 9 月 12 日
I meant to respond on this; the third stage is the key step that I did incorrectly. Thanks.

サインインしてコメントする。


Geoffrey Vincent
Geoffrey Vincent 2018 年 9 月 12 日
編集済み: Geoffrey Vincent 2018 年 9 月 12 日
Error for me also :
Error using matlab.ui.internal.dialog.FolderChooser/doShowDialog (line 70)
Java exception occurred:
java.lang.IllegalArgumentException: eval requires a valid MCR id when running in standalone mode.
at com.mathworks.jmi.NativeMatlab.PostMatlabMessage(Native Method)
at com.mathworks.jmi.NativeMatlab.postMatlabMessage(NativeMatlab.java:224)
at com.mathworks.jmi.NativeMatlab.postMatlabMessage(NativeMatlab.java:240)
at com.mathworks.jmi.MatlabLooper.postMatlabMessage(MatlabLooper.java:150)
at com.mathworks.jmi.MatlabMCR.postAsync(MatlabMCR.java:1542)
at com.mathworks.jmi.MatlabMCR.eval(MatlabMCR.java:518)
at com.mathworks.jmi.Matlab.eval(Matlab.java:1197)
at com.mathworks.jmi.MatlabPath$PathCallback.completed(MatlabPath.java:1449)
at com.mathworks.jmi.MatlabMCR$InterestHandler.messageReceived(MatlabMCR.java:1663)
at com.mathworks.jmi.NativeMatlab.ProcessPendingEvents(Native Method)
at com.mathworks.jmi.NativeMatlab.processPendingEvents(NativeMatlab.java:508)
at com.mathworks.jmi.AWTUtilities$MatlabLatch.safeWait(AWTUtilities.java:892)
at com.mathworks.jmi.AWTUtilities$MatlabLatch.waitFcn(AWTUtilities.java:907)
at com.mathworks.jmi.AWTUtilities$Latch.acquire(AWTUtilities.java:770)
at com.mathworks.jmi.AWTUtilities$Invoker.invoke(AWTUtilities.java:500)
at com.mathworks.jmi.AWTUtilities.invokeAndWaitInternal(AWTUtilities.java:250)
at com.mathworks.jmi.AWTUtilities.invokeAndWait(AWTUtilities.java:111)
Error in matlab.ui.internal.dialog.FolderChooser/show (line 48)
Error in uigetdir_helper (line 32)

  1 件のコメント

Miguel Alfonso Mendez
Miguel Alfonso Mendez 2018 年 11 月 28 日
I have the same problem:
Error using matlab.ui.internal.dialog.FolderChooser/doShowDialog (line 70)
Java exception occurred:
java.lang.IllegalArgumentException: eval requires a valid MCR id when running in standalone mode.
at com.mathworks.jmi.NativeMatlab.PostMatlabMessage(Native Method)
at com.mathworks.jmi.NativeMatlab.postMatlabMessage(NativeMatlab.java:224)
at com.mathworks.jmi.NativeMatlab.postMatlabMessage(NativeMatlab.java:240)
at com.mathworks.jmi.MatlabLooper.postMatlabMessage(MatlabLooper.java:150)
at com.mathworks.jmi.MatlabMCR.postAsync(MatlabMCR.java:1542)
at com.mathworks.jmi.MatlabMCR.eval(MatlabMCR.java:518)
at com.mathworks.jmi.Matlab.eval(Matlab.java:1197)
at com.mathworks.jmi.MatlabPath$PathCallback.completed(MatlabPath.java:1449)
at com.mathworks.jmi.MatlabMCR$InterestHandler.messageReceived(MatlabMCR.java:1663)
at com.mathworks.jmi.NativeMatlab.ProcessPendingEvents(Native Method)
at com.mathworks.jmi.NativeMatlab.processPendingEvents(NativeMatlab.java:508)
at com.mathworks.jmi.AWTUtilities$MatlabLatch.safeWait(AWTUtilities.java:892)
at com.mathworks.jmi.AWTUtilities$MatlabLatch.waitFcn(AWTUtilities.java:907)
at com.mathworks.jmi.AWTUtilities$Latch.acquire(AWTUtilities.java:770)
at com.mathworks.jmi.AWTUtilities$Invoker.invoke(AWTUtilities.java:500)
at com.mathworks.jmi.AWTUtilities.invokeAndWaitInternal(AWTUtilities.java:250)
at com.mathworks.jmi.AWTUtilities.invokeAndWait(AWTUtilities.java:111)
Error in matlab.ui.internal.dialog.FolderChooser/show (line 48)
Error in uigetdir_helper (line 32)

サインインしてコメントする。

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by