wood burning stoves 2.0*
The moose likes IDEs, Version Control and other tools and the fly likes How to terminate current JVM process and relaunch the same main method? 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 » Engineering » IDEs, Version Control and other tools
Bookmark "How to terminate current JVM process and relaunch the same main method?" Watch "How to terminate current JVM process and relaunch the same main method?" New topic
Author

How to terminate current JVM process and relaunch the same main method?

Volodymyr Levytskyi
Ranch Hand

Joined: Mar 29, 2012
Posts: 505
    
    1

Hello!

I am using eclipse kepler and I want to be very quick doing my swing application.
So, I want to terminate current JVM process so that JFrame is closed and then I want to launch the same main method again.
And I want to do it in one key binding.
Currently I terminate JVM by pressing red icon on console and then Ctrl+f11 to launch the same main method again.

I want to terminate and relaunch my main method in one key binding. Please tell exactly how to configure it.

Thank you!


True person is moral, false is right!
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5836
    
    7

I think you want the Restart command, but it doesn't have a key binding. Go to Window | Preferences | General | Keys and scroll down to the Restart command and assign it a key binding.


JBoss In Action
Volodymyr Levytskyi
Ranch Hand

Joined: Mar 29, 2012
Posts: 505
    
    1

Thanks for reply!

This does not work.
I assigned Alt+Shift+F11 to Restart option for Run/Debug.
I start main method by Ctrl+F11 as usual and then Alt+Shift+F11 does not work.
There is no restart option in eclipse console but only Terminate.

How to make my eclipse kepler to restart main method if there is no restart button in console but only Terminate ?
Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3610
    
  60

If it was me, I'd probably just assign Alt-Shift-F10 to Terminate, and Alt-Shift-F11 to Restart. That would allow me to press the two key combinations in a really quick succession.

A quick google for Eclipse Macros revealed there might be some ways to add macro support to Eclipse IDE. It might be a solution for you if you really need to execute two actions by a single keystroke.
Volodymyr Levytskyi
Ranch Hand

Joined: Mar 29, 2012
Posts: 505
    
    1

Unfortunately nothing works.
I tried Terminate,"Terminate and Relaunch" and Restart with Al+Shift+F12 and Al+Shift+F11 and Al+Shift+F10.
I set 'when' to 'In Windows' and Category is Run/Debug for all options.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5836
    
    7

Ah, the joys of configuring hot-keys in Eclipse! If you look at some of the existing key bindings, you will note that they are active only in certain contexts. In kepler, on the Key dialog, the context is the "When:" dropdown box. The trick to getting your key bindings to work is configuring the correct context, so try playing around with different settings for "When:". If none of those work, then you are sort of stuck, I know of no other way to do what you want.

(Yes I agree that Eclipse key binding is the most convoluted, dysfunctional pieces of @#$%^ I have ever dealt with.)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to terminate current JVM process and relaunch the same main method?