Help me restart a .jar application
April 20, 2006 12:19 PM   Subscribe

I have an errant .jar file that seems to hang from time to time. I would like to automate it's restart. I know how to perform a close or kill of a standard windows application, how is this done to a .jar file within the Java environment?
posted by kc0dxh to Computers & Internet (7 answers total)
 
I'm not sure exactly what you're asking here, because a jar is not in itself a natively executable entity. If you have a java app that halts because it's throwing an exception from a class contained within the jar, it's either a bug in the jar, the calling class, or some unhandled case. There's probably nothing you can do in this case without modifying the code, unless it's something like a missing file exception that can be avoided.

If it's a java app contained within a single jar that hangs, you can treat it like a standard Windows app - which it is, the app in this case being the java virtual machine (java.exe or javaw.exe).
posted by ny_scotsman at 12:34 PM on April 20, 2006


It is the latter of your two guesses, ny_scotsman. I would gladly restart javaw.exe except that I have more than one java app running. I wish to restart the one without disturbing the other. I'm woefully ignorant of java and all it's baggage.
posted by kc0dxh at 12:51 PM on April 20, 2006


What OS? Under NetWare, I'd run "java -show" to see the current apps, and then "java -kill" to stop the bad one.
posted by sbutler at 1:30 PM on April 20, 2006


This is XP Pro SP2. I'm guessing you're on the right track, sbutler, but -show and -kill give the following error:

Unrecognized option: -show
Could not create the Java virtual machine.
posted by kc0dxh at 1:44 PM on April 20, 2006


Yeah, because it's a NetWare extension.

Are you *sure* multiple instances of the JVM aren't running for multiple apps? Looking at Windows, I'm not even sure how I'd get multiple apps loaded into the same instance.
posted by sbutler at 2:00 PM on April 20, 2006


I'll double check, I'm not at that machine now. For the sake of the argument, lets say that there are two javaw.exe's listed in task manager. How can ID which one is running the app I want to kill?
posted by kc0dxh at 2:06 PM on April 20, 2006


That's a more difficult question. You can download ProcessExplorer, right click on a process, and then check its command line arguments.
posted by sbutler at 2:13 PM on April 20, 2006


« Older Whiteout on the index?   |   Exercise question Newer »
This thread is closed to new comments.