Call of a jar-file (compiled with matlab), throw complete stack (of matlab errors) back to java
4 views (last 30 days)
Show older comments
Andreas on 4 Jan 2017
Commented: Andreas on 22 Jan 2017
I'm trying to integrate a compiled matlab-programm (as a jar-file) into a java-environment.
1) Is it possible to get a complete stack-trace back to original calling jar-file out of matlab? (Line numbers, functions, ...)
Up to now, it seems that I've to use something like that:
msgText = getReport(ME,'extended','hyperlinks','off');
msgText2 = regexprep(msgText,'\s+',' ');
baseException = MException(msgID,msgText2);
2) Is it possible that the all exceptions are formated in that way, without defining a try-catch-block around the whole function?
Sanjana Ramakrishnan on 19 Jan 2017
1.The message text and stack information would be available in an 'MWException' class in Java. You can use a try/catch on the java side to capture the same. Refer the following example:
foo.Class1 c = new foo.Class1();
2. Since MWExceptions don’t include the message id, you can write a small function to capture the desired information rather than include it in each try catch.
More Answers (0)
Find more on MathWorks Cloud Center in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!