Thread Subject: accessing java gui from Matlab

Subject: accessing java gui from Matlab

From: Todd Welti

Date: 4 Apr, 2009 20:08:01

Message: 1 of 5

Is there any way to access an object in a separate Java gui from matlab? I am running a Java gui (not running from Matlab) and also an app in Matlab. I would like to access the Java gui from Matlab (and changel a slider value in the Java app). I'm guessing this might be impossible. Is there some way to run the Java app from Matlab and get a handle to it?

Subject: accessing java gui from Matlab

From: Yair Altman

Date: 4 Apr, 2009 20:22:02

Message: 2 of 5

> Is there any way to access an object in a separate Java gui from matlab? I am running a Java gui (not running from Matlab) and also an app in Matlab. I would like to access the Java gui from Matlab (and changel a slider value in the Java app). I'm guessing this might be impossible.

Correct - AFAIK you cannot access a Java frame from another JVM.

> Is there some way to run the Java app from Matlab and get a handle to it?

Yes - Matlab runs its own JVM and can run Java classes directly. You will then have access to your Java GUI and can manipulate it from within Matlab.

Yair Altman
http://UndocumentedMatlab.com
 

Subject: accessing java gui from Matlab

From: Todd Welti

Date: 6 Apr, 2009 16:53:01

Message: 3 of 5

"Yair Altman" <altmanyDEL@gmailDEL.comDEL> wrote in message <gr8fh9$7bc$1@fred.mathworks.com>...
> > Is there any way to access an object in a separate Java gui from matlab? I am running a Java gui (not running from Matlab) and also an app in Matlab. I would like to access the Java gui from Matlab (and changel a slider value in the Java app). I'm guessing this might be impossible.
>
> Correct - AFAIK you cannot access a Java frame from another JVM.
>
> > Is there some way to run the Java app from Matlab and get a handle to it?
>
> Yes - Matlab runs its own JVM and can run Java classes directly. You will then have access to your Java GUI and can manipulate it from within Matlab.
>
> Yair Altman
> http://UndocumentedMatlab.com
>

Thanks, how do I run it?

Subject: accessing java gui from Matlab

From: Todd Welti

Date: 6 Apr, 2009 16:57:01

Message: 4 of 5

"Yair Altman" <altmanyDEL@gmailDEL.comDEL> wrote in message <gr8fh9$7bc$1@fred.mathworks.com>...
> > Is there any way to access an object in a separate Java gui from matlab? I am running a Java gui (not running from Matlab) and also an app in Matlab. I would like to access the Java gui from Matlab (and changel a slider value in the Java app). I'm guessing this might be impossible.
>
> Correct - AFAIK you cannot access a Java frame from another JVM.
>
> > Is there some way to run the Java app from Matlab and get a handle to it?
>
> Yes - Matlab runs its own JVM and can run Java classes directly. You will then have access to your Java GUI and can manipulate it from within Matlab.
>
> Yair Altman
> http://UndocumentedMatlab.com
>

... the Java app is normally run from a bat file:

@echo off
java -classpath .;.\jna.jar com.hbas.asioConvGui.ASIOConvGUI > log.txt

I tried running this direcly in Matlab, but didn't work.

Subject: accessing java gui from Matlab

From: Steven Lord

Date: 7 Apr, 2009 21:24:21

Message: 5 of 5


"Todd Welti" <twelti@harman.com> wrote in message
news:grdc8t$5j1$1@fred.mathworks.com...
> "Yair Altman" <altmanyDEL@gmailDEL.comDEL> wrote in message
> <gr8fh9$7bc$1@fred.mathworks.com>...
>> > Is there any way to access an object in a separate Java gui from
>> > matlab? I am running a Java gui (not running from Matlab) and also an
>> > app in Matlab. I would like to access the Java gui from Matlab (and
>> > changel a slider value in the Java app). I'm guessing this might be
>> > impossible.
>>
>> Correct - AFAIK you cannot access a Java frame from another JVM.
>>
>> > Is there some way to run the Java app from Matlab and get a handle to
>> > it?
>>
>> Yes - Matlab runs its own JVM and can run Java classes directly. You will
>> then have access to your Java GUI and can manipulate it from within
>> Matlab.
>>
>> Yair Altman
>> http://UndocumentedMatlab.com
>>
>
> ... the Java app is normally run from a bat file:
>
> @echo off
> java -classpath .;.\jna.jar com.hbas.asioConvGui.ASIOConvGUI > log.txt
>
> I tried running this direcly in Matlab, but didn't work.

Open up the Help Browser using the DOC function. In the main MATLAB
documentation there's a chapter titled "External Interfaces". One of the
sections of that chapter describes the steps you'll need to follow to use
Java from within MATLAB.

--
Steve Lord
slord@mathworks.com

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
gui hashem tamaddon 10 Sep, 2009 16:32:08
java gui object Todd Welti 4 Apr, 2009 16:10:04
rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com