Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible for Eclipse to only open one JFrame?

When run the project second time, can the previous JFrame closed before open the new one ?

So I no need to close the JFrame when trying to run the project second time.

enter image description here

Is it possible to open only one JFrame?

like image 401
John Joe Avatar asked May 31 '17 16:05

John Joe


4 Answers

Eclipse has the possibility of terminating the launched program before starting the new one: It is called Terminate and Relaunch (see the Documentation).

You can bind this to any shortcut you like (Window -> Preferences -> General -> Keys).

like image 108
Tobias Walter Avatar answered Nov 07 '22 21:11

Tobias Walter


Apparently, eclipse offers some special options to get what you want.

For other people who might be using a different editor: it's possible, but you'd need some kind of communication between the processes.

What you can do is this, make a server application that runs independently and have it open before you start your regular application. When you run your regular application, connect to the server. This server now messages the other application that was running to close down.

If running a server application is too much trouble, you can run both the server and the client in the same application. When you start the application, check if the designated port is busy, if not, create a server. If it is busy, connect to the server and tell it to shut down. After that, open the server socket in the new application.

like image 43
Thijs Steel Avatar answered Nov 07 '22 19:11

Thijs Steel


Select the Terminate and Relaunch command [ Terminate and Relaunch ] to first terminate the selected debug target and secondly, relaunch it.

Once a launch is terminated it can be automatically removed from the Debug View. To change this setting use the Opens the Launching preference page Run/Debug > Launching preference page.

like image 3
Vikas Suryawanshi Avatar answered Nov 07 '22 19:11

Vikas Suryawanshi


you may find relaunch-plugin for eclipse useful for your case.

like image 2
Daniel Taub Avatar answered Nov 07 '22 21:11

Daniel Taub