Info

This question is closed. Reopen it to edit or answer.

Magicsquear example compiled with Builder JA does not terminate when called in Java, JVM keeps running even though I call System.exit(0) - How can I terminate the JVM?

2 views (last 30 days)
Hello,
I have compiled the magicsquare example and it seems to execute correctly when called from a java method. However the JVM doesn't terminate when I call System.exit(0);
Below is the code that I'm using:
public static void main(String[] args) {
MWNumericArray n = null;
Object[] result = null;
magic theMagic = null;
try {
n = new MWNumericArray(Double.valueOf(args[0]), MWClassID.INT32);
System.out.println("Input: " + n.toString());
theMagic = new magic();
result = theMagic.magicsquare(1, n);
System.out.println("result: " + result[0]);
MWArray.disposeArray(n);
MWArray.disposeArray(result);
if (theMagic != null) {
theMagic.dispose();
}
n = null;
result = null;
theMagic = null;
System.out.println("before sys exit");
System.exit(0);
System.out.println("after sys exit");
} catch (Exception e) {
System.out.println("Exception: " + e.toString());
}
}
And the output is:
Input: 4
m =
16 2 3 13
5 11 10 8
9 7 6 12
4 14 15 1
result: 16 2 3 13
5 11 10 8
9 7 6 12
4 14 15 1
before sys exit
But the console in Eclipse doesn't terminate and I have to manually terminate it by clicking on the Terminate button.
I also recompiled the matlab function and I removed the m = ... console printout and the JVM still doesn't terminate on System.exit :(
Thank you in advance.

Answers (0)

Community Treasure Hunt

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

Start Hunting!