JVM shut down ala Eclipse or Jbuilder

S

Sambucus

Hi all,
anyone who knows how to force a running jvm to shut down like Eclipse
or Jbuilder does when you press their little stop button?

I have this problem with some sockets refusing to shut down (I guess
it is because they are blocking for input). When I run my app from
eclipse and use a normal System.exit(); or
Runtime.getRuntime().halt(0); the app refuses to shut down, however,
if I press eclipses stop/shutdown button it imideatly shuts down the
jmv and all sockets. I would like to know if there is some way to
implement this from within my app?

Any help much appritiated!

/Andreas
 
S

Sambucus

Ehh, yes of course, but that will not work for me I'm afraid.
I dont know if eclipse/jbuilder uses a native call to end the jvm
process? In that case it would be the same as using the task manager,
but can you implement that into a Java app?
 
A

Ann

Sambucus said:
Ehh, yes of course, but that will not work for me I'm afraid.
I dont know if eclipse/jbuilder uses a native call to end the jvm
process? In that case it would be the same as using the task manager,
but can you implement that into a Java app?

"Ann" <[email protected]> wrote in message
Use Runtime
Taskkill
Ends one or more tasks or processes. Processes can be killed by process ID
or image name.
Syntax
taskkill [/s Computer] [/u Domain\User [/p Password]]] [/fi FilterName]
[/pid ProcessID]|[/im ImageName] [/f][/t]
 
J

John English

Sambucus said:
Ehh, yes of course, but that will not work for me I'm afraid.
I dont know if eclipse/jbuilder uses a native call to end the jvm
process? In that case it would be the same as using the task manager,
but can you implement that into a Java app?

Try Runtime.exit() -- "terminates the currently running Java virtual
machine by initiating its shutdown sequence".

-----------------------------------------------------------------
John English | mailto:[email protected]
Senior Lecturer | http://www.it.bton.ac.uk/staff/je
School of Computing & MIS | ** NON-PROFIT CD FOR CS STUDENTS **
University of Brighton | -- see http://burks.bton.ac.uk
-----------------------------------------------------------------
 
A

Andrew Thompson

Try Runtime.exit() -- "terminates the currently running Java virtual
machine by initiating its shutdown sequence".

Which, according to the JavaDocs "The System.exit method is
the conventional and convenient means of invoking this method"

The OP mentioned earlier that invoking System.exit() was (amongst)
the current way of doing things.

[ Follow-Ups set to c.l.j.help. ]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,062
Latest member
OrderKetozenseACV

Latest Threads

Top