From: Weijian on
Hi,

I am following the simple "magic" example in MATLAB Builder JA -> Getting Started -> Deploying a Component with the Magic Square Example.

I created a Java project, inside which I call the jar file created by Java Builder. I can successfully invoke the magic method and print out the magic square. But after that the java program just hangs there.

I trace the suspicious problem to one Java thread which has the following stack:

com.mathworks.toolbox.javabuilder.internal.MWMCR.mclTerminateApplication(Native Method)
com.mathworks.toolbox.javabuilder.internal.MWMCR.shutdown(MWMCR.java:55)
- locked java.lang.Class(a)578088c0
com.mathworks.toolbox.javabuilder.internal.MWMCR.access$14300(MWMCR.java:28)
com.mathworks.toolbox.javabuilder.internal.MWMCR$7.run(MWMCR.java:1479)

MWMCR.mclTerminateApplication hangs there.

Does anyone have some insight? Many thanks in advance!

The more java stack info:

uk.ac.soton.rbm.matlab.magic.Test at localhost:3819
Daemon Thread [MATLAB Component Runtime] (Running)
Thread [DestroyJavaVM] (Running)
Thread [Thread-0] (Running)
Daemon Thread [Image Fetcher 0] (Running)

Name: Thread-0
State: RUNNABLE
Total blocked: 0 Total waited: 0

Stack trace:
com.mathworks.toolbox.javabuilder.internal.MWMCR.mclTerminateApplication(Native Method)
com.mathworks.toolbox.javabuilder.internal.MWMCR.shutdown(MWMCR.java:55)
- locked java.lang.Class(a)578088c0
com.mathworks.toolbox.javabuilder.internal.MWMCR.access$14300(MWMCR.java:28)
com.mathworks.toolbox.javabuilder.internal.MWMCR$7.run(MWMCR.java:1479)

Name: DestroyJavaVM
State: WAITING on com.mathworks.toolbox.javabuilder.internal.MWMCR$7(a)58a17083
Total blocked: 1 Total waited: 2

Stack trace:
java.lang.Object.wait(Native Method)
java.lang.Thread.join(Unknown Source)
java.lang.Thread.join(Unknown Source)
java.lang.ApplicationShutdownHooks.runHooks(Unknown Source)
java.lang.ApplicationShutdownHooks$1.run(Unknown Source)
java.lang.Shutdown.runHooks(Unknown Source)
java.lang.Shutdown.sequence(Unknown Source)
java.lang.Shutdown.shutdown(Unknown Source)
- locked java.lang.Class(a)7a982589

Name: MATLAB Component Runtime
State: WAITING on java.awt.MediaTracker(a)15837e8
Total blocked: 0 Total waited: 1

Stack trace:
java.lang.Object.wait(Native Method)
java.awt.MediaTracker.waitForID(Unknown Source)
javax.swing.ImageIcon.loadImage(Unknown Source)
javax.swing.ImageIcon.<init>(Unknown Source)
javax.swing.ImageIcon.<init>(Unknown Source)
com.mathworks.mwswing.desk.Desktop.createContrastingIcon(Desktop.java:146)
com.mathworks.mwswing.desk.Desktop.<clinit>(Desktop.java:130)
java.lang.Class.forName0(Native Method)
java.lang.Class.forName(Unknown Source)
com.mathworks.jmi.Matlab.matlabQuitting(Matlab.java:663)

Name: Image Fetcher 0
State: RUNNABLE
Total blocked: 0 Total waited: 0

Stack trace:
java.awt.Rectangle.initIDs(Native Method)
java.awt.Rectangle.<clinit>(Unknown Source)
sun.awt.image.ByteInterleavedRaster.<init>(Unknown Source)
java.awt.image.Raster.createInterleavedRaster(Unknown Source)
java.awt.image.Raster.createInterleavedRaster(Unknown Source)
java.awt.image.Raster.createInterleavedRaster(Unknown Source)
java.awt.image.IndexColorModel.createCompatibleWritableRaster(Unknown Source)
sun.awt.image.ImageRepresentation.createBufferedImage(Unknown Source)
sun.awt.image.ImageRepresentation.setPixels(Unknown Source)
- locked sun.awt.image.ImageRepresentation(a)559fe5e6
sun.awt.image.ImageDecoder.setPixels(Unknown Source)
sun.awt.image.GifImageDecoder.sendPixels(Unknown Source)
sun.awt.image.GifImageDecoder.parseImage(Native Method)
sun.awt.image.GifImageDecoder.readImage(Unknown Source)
sun.awt.image.GifImageDecoder.produceImage(Unknown Source)
sun.awt.image.InputStreamImageSource.doFetch(Unknown Source)
sun.awt.image.ImageFetcher.fetchloop(Unknown Source)
sun.awt.image.ImageFetcher.run(Unknown Source)