aspose file tools*
The moose likes Java in General and the fly likes Shut down JVM using command Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Shut down JVM using command" Watch "Shut down JVM using command" New topic
Author

Shut down JVM using command

B Nirvan
Ranch Hand

Joined: Oct 20, 2010
Posts: 82
Hi,
Is it possible to shut down JVM using command ? Actually I am using glassfish v3 and after a few re-deployments of my development project, the JVM complains of "java.lang.OutOfMemoryError: PermGen space". I have posted the the question in glassfish 3 forum Glassfish Out of Memmory problem. Till I resolve the out of memory error, I need to manually shut down the JVM to release memory. So I am looking for the shutdown command for the JVM.

regards,
Nirvan
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3838

Have you checked the documentation for the memory requirements?
I need to manually shut down the JVM to release memory

You can shutdown (results in JVM shutdown) the glassfish.


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
B Nirvan
Ranch Hand

Joined: Oct 20, 2010
Posts: 82

Have you checked the documentation for the memory requirements?

I have given 1024MB for PermGen space. That should be more than enough. I had come across a few sites that said that there were some memory leaks for glassfish 2 related to class loaders. I am not sure whether that problem passed through to v3. I will have to take a look at the problem in more detail, but right now I am only concentrating on development.
You can shutdown (results in JVM shutdown) the glassfish.

This is what I was expecting. But to my surprise, the server status in my netbeans IDE already shows shut down. Eventually when I try to start the glassfish again, the "out of memory" corps out again. Its only after I shut down my PC and restart it again, that the "out of memory" fades off. I was looking for a quick fix so that I can continue development without having to restart my pc every now and then.

regards,
Nirvan
Marco Ehrentreich
best scout
Bartender

Joined: Mar 07, 2007
Posts: 1282

Its only after I shut down my PC and restart it again, that the "out of memory" fades off. I was looking for a quick fix so that I can continue development without having to restart my pc every now and then.


From my experience with Tomcat it's often too late for a regular shutdown, when the server JVM hangs because of an out-of-memory problem. But it shouldn't be necessary to restart your computer in order to force the JVM to shutdown. It should be enough to kill the corresponding Java process. Depending on your OS you'll have to use the Windows task manager, a Linux console or something like this to find and kill the Java process which belongs to the Glassfish server. But you should take care not to kill other Java process for example the one for your NetBeans IDE ;-) On Linux it's easy to find the right Java process because you can usually see the whole command line for the process in question and figure out if it's the JVM process used to startup Glassfish.

Hope this helps with your development although I don't know how to solve the root cause of the problem!

Marco
B Nirvan
Ranch Hand

Joined: Oct 20, 2010
Posts: 82
Macro,
Killing the glassfish process worked for me. That was indeed a very quick fix. Thanks a lot.

regards,
Nirvan.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Shut down JVM using command