• Post Reply Bookmark Topic Watch Topic
  • New Topic

Stopping and Restarting the jvm  RSS feed

 
Ranch Hand
Posts: 181
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a situation like this:

I need to exit my program(exiting the jvm) and I need to restart the jvm without using a batch file. I believe that many people have tried it before.

Pls let me know the solution for this..

Thanks in advance.
 
Ranch Hand
Posts: 1071
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think this is possible without using external code.

You could probably start a new JVM using the exec method of the Runtime class:

and then shut down the JVM you're in
 
Marshal
Posts: 56610
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried that this morning, with a class which read something like this:-The javac part worked nicely; I could even get compiler errors if I tried.
But I got nothing whatsoever from the "java HelloWorld" part.
Anybody know anything they could suggest?
 
Ranch Hand
Posts: 1170
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The request is illogical. starting a JVM is something done in the environment of the OS. It is not performed within a running JVM. If you manage to do it, it will be through the help of the OS. Making a script just makes your life easier. If you are looking for an OS independent way, I am not sure you will find one. Furthermore, the new jvm will be started within the environment of the old JVM. So its somewhat tricky I suppose.
 
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The javac part worked nicely; I could even get compiler errors if I tried.
But I got nothing whatsoever from the "java HelloWorld" part.
Anybody know anything they could suggest?


Did you confirm that the compilation was finished, before you try to run it?

The request is illogical. starting a JVM is something done in the environment of the OS. It is not performed within a running JVM. If you manage to do it, it will be through the help of the OS. Making a script just makes your life easier. If you are looking for an OS independent way, I am not sure you will find one. Furthermore, the new jvm will be started within the environment of the old JVM. So its somewhat tricky I suppose.


In total agreement. There is also another issue. With certain Operation Systems, child processes are automatically terminated when the parent process terminates... which would be *not* what the original poster wanted.

Henry
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!