Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Profiling Java in Matlab
Date: Wed, 31 Oct 2007 21:59:55 +0000 (UTC)
Organization: TACT Computer Systems Ltd
Lines: 42
Message-ID: <fgatsr$e8r$1@fred.mathworks.com>
References: <fcqhf3$fcj$1@fred.mathworks.com> <feg3vs$6ha$1@fred.mathworks.com> <fgaj1g$imo$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1193867995 14619 172.30.248.37 (31 Oct 2007 21:59:55 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 31 Oct 2007 21:59:55 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 642467
Xref: news.mathworks.com comp.soft-sys.matlab:435509



Michael,

I'm absolutely thrilled that someone at TMW, finally after
all these years, has taken the time to publicly comment on
this issue. Please be assured that readers of this thread
understand that the entire issue of Swing/JMI integration is
not officially supported, and that the API is subject to
change and might contain bugs.

This said, please let us know if we may approach you (or
Bill, who has shown a flicker of Java-related interest) with
Java-related bugs/requests. All official doors are closed to
us, you know, because of the unsupported nature. You've
shown an interest in advancing ML-Java integration - user
inputs may help.

To the point: awtinvoke (and related parseJavaSignature)
have several limitations/bugs that prevent its usage in some
cases. In other cases, problems in the Java objects
reflection visibility, which is used by awtinvoke, cause
awtinvoke to fail. In all these cases we have to resort to
using the direct calling syntax:

jbutton.setLabel('Close');

Unfortunately, starting with R2007b, this syntax displays an
ugly warning and stack dump on the Command Window, although
the call itself works well. One has to use another
undocumented feature to turn the warnings off (I don't think
this has ever been reported yet): 

com.mathworks.mwswing.MJUtilities.setThreadingChecksEnabled(0);

Another major problem using Java in Matlab is that AFAIK
Java exceptions cannot be caught (via matlab's try-catch)
nor suppressed from the Command Window.

I think I'll stop here (there's plenty more where this came
from). If you, Bill or anyone picks up the ball I'll be
happy to expand, and I'm sure others will too.

Yair Altman