Simple (I suppose..) problem with Threads

In the main I do this:

publicstaticvoid main(String[] args){

new MyThread(...).start();

}

In MyThread I do this:

publicvoid run(){

// do something ...

System.out.println("end..");

}

I know that thread reaches the end.. but the program itself doesn't exit.

Have you any idea?

Thanks!

[719 byte] By [Leonardo_Da_Vincia] at [2007-10-2 21:04:41]
# 1
Is that all? Do you have a GUI?Kaj
kajbja at 2007-7-13 23:49:54 > top of Java-index,Java Essentials,New To Java...
# 2

Yes, in the

// do something...

I've a lot of code that operates mainly with the open office libraries and connect to the soffice service. (however I have no GUI)

However I know that the thread reaches the end, because i can see on the console that "println" command..

However the main doesn't finish.

Leonardo_Da_Vincia at 2007-7-13 23:49:54 > top of Java-index,Java Essentials,New To Java...
# 3

> Yes, in the

>

> > // do something...

>

>

> I've a lot of code that operates mainly with the open

> office libraries and connect to the soffice service.

> (however I have no GUI)

>

> However I know that the thread reaches the end,

> because i can see on the console that "println"

> command..

> However the main doesn't finish.

I asked about GUI since UI components starts the AWT thread, and that thread does not terminate when the other threads terminates. Run the code in a console on windows, and press ctrl + break. That will print a thread dump which shows the threads that are alive.

Kaj

kajbja at 2007-7-13 23:49:54 > top of Java-index,Java Essentials,New To Java...