This discussion is archived
0 Replies Latest reply: Jun 23, 2009 4:19 AM by 843804 RSS

Routine using JACOB API unable to return

843804 Newbie
Currently Being Moderated
Hello

I'm trying to retrieve some system informations through Windows Management Interface and JACOB ActiveX Bridge.

I'm new to JACOB, so I began to make some test with some sample code I found on the net. I found it quite simple but I couldn't understand why all the times I try to create an ActiveXComponent like in the following code the JVM doesn't exit, returning the control to the shell that launched the program, if I don't explicitly call a System.exit() method. Even pressing Ctrl-C i couldn't find the way to terminate the process, I can only explicitly kill it with a task manager to have control back on the shell.
package test;

import com.jacob.activeX.*;


public class Prova {
     public static void main(String[] args) {
          ActiveXComponent component = new ActiveXComponent("WinMgmts:");
          component.safeRelease();
          return;
          //System.exit(0);
     }
}
and here follows the used command line :
java -cp jacob-1.15-M1\jacob.jar;bin -Djava.library.path=jacob-1.15-M1\ test.Prova
While debugging this code througth eclipse I found that, after the main method execution, it enters into Thread.exit() and then, once processed Thread.exit(), the process seems terminated, but it doesn't do anything to give the control to the user and the program keeps running without performing any action.

Could you please help me to find out the reason of this strange behavior?

Bye Alessandro