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.
Is it possible to open only one JFrame?
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).
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.
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.
you may find relaunch-plugin for eclipse useful for your case.
I don't know about eclipse but i usually run two or more JFrame applications in (IntelliJ idea) belonging to different classes at a time. The previous one will not be closed. One more thing i would like to suggest you to use IntelliJ Idea from Jetbrains company as the UI,shortcuts and all other stuff are same as in Android Developer kit(studio) which is also sponsored and developed by Jetbrains!..
You can check the JFrame applications running simultaneously in this image.
Hope this answer is somewhat informative.......
!>...
Related
I have a java application running on Windows (javaw.exe) and I would like to close the child windows through a C# application. I can see the child windows through task manager under the Applications tab but when I right-click on the child windows and click Go To Process, it takes me to the javaw.exe process running under the Processes tab.
I have tried iterating through active processes to close each window however, I am unable to find the child java windows and only can see the javaw process.
Process[] childProcesses = Process.GetProcessesByName("javaw");
I have searched the internet forums and have not been able to find a proper solution that deals with a java application running on windows to be be dealt with using C#. I'm sure there is an obvious solution so any help is much appreciated. Thanks.
If I understand correctly your problem, you want to close one or more window among many of a java application ?
You won't have child processes on javaw, you only have threads running inside the JVM. Maybe using the Threads property of the process object could help.
But even doing that, all graphic objects in a java application are rules by the AWT Thread. Killing it will mean closing all the windows.
So i don't think it's possible to do what you want to do :/
Could you try to get handle of the child window and send message to it using P\Invoke methods and calling win32 api?
Maybe this answer can cover this idea:Cannot use pinvoke to send WM_CLOSE to a Windows Explorer window
I usually develop mobile apps for iOS and Android and I am used to launching projects repeatedly without asking if another instance is running or not, since the simulators will handle this for me.
When I use Eclipse to develop desktop apps, I face this problem since running multiple times the same project will result in multiple different instances. I would like Eclipse to be able to kill the previously-opened processes before running the new one. I've found this question, but this one addresses the problem to let a single instance of a Java application run, but this is not quite the point. I do not care if the final release will run one or two times, I just want to be able to run a single instance when developing, seamlessly like Xcode or Eclipse for Android do. Moreover, that solution will popup an alert when running the same project twice, but that's not a solution for me. Kill and run, that it.
Is it possible to change the run configuration of the project to achieve this without changing the source code, or is this achievable with a plugin or whatelse? I would like to find a completely automated solution that could make me work as if I were under Xcode.
No, it is not possible to change the Eclipse run configuration so that Eclipse stops existing instance before running new instance.
As an alternative, you might try setting a keyboard shortcut for "Terminate" action.
What is the short cut in eclipse to terminate debugging/running?
Is there a keyboard shortcut for stopping the current console in Eclipse?
As a general solution to this, try:
Goto Window->Preferences, search for Launching.
Select the "Terminate and Relaunch while launching" option.
Press Apply.
Not sure if it would work while developing Android (not very common in Eclipse now), but good option to know.
I own a game server and I was just wondering, instead of running the server in eclipse and then when I restart it, it opens a new cmd prompt outside of eclipse and runs the server on that. Could I make it so the program relaunches in eclipse as if I hit the green play button?
I was reading your comments on this post. You said that you don't want to kill the program and then restart from within eclipse. So you have two options.
Bad Answer: Just press ctrl + F11 (relaunch the application and ignore the old one)
Good Answer: Press F11 then go to what looks like a computer in the console tab. You can select the previous running program and kill it and the second one will still be running.
If what you want to do is transfer the data and keep it the same run time state, well to say the least that is going to be some what complex. I would make some kind of method to transfer all current data and call it from your constructor. Then start your second program and kill the original. I'm 90% sure all your users will get booted though.
I wish the run command (usually default to CTRL+F11 combination) of a Java project (and C++ if you know it too) to automatically close the previous process (or all processes, if it's easier) started by it before it runs a new instance.
In short, running a project should also close previous app instance. Is it possible?
Maybe it's possible to add code to the app itself, and disable it once I don't need it anymore? I want it since it's annoying to close the app each time. I don't need so many instances of the app.
In Eclipse Neon go to Window -> Preferences -> Run/Debug -> Launching and in the Launch Operation section check:
[X] Terminate and Relaunch while launching
Easier said than done. I suggest you terminate the process yourself by clicking on the little red stop icon in the console or by terminating the main thread from the threads view in the debugger perspective.
That's not possible with Eclipse built-in features. The easiest way to automate this seems to be
Install the launch group feature from CDT (you only need the mentioned feature) or the EclipseRunner plugin. They allow creation of "batch" launch configurations.
Create an external run configuration with a "kill" command (depending on your operating system), which can kill your application process based on the application name.
Create a batch launch group with one of the two plugins mentioned above, where the "kill" configuration comes first and your normal launch configuration comes second.
I'm using the Google AppEngine development server on Eclipse. My local webpage just doesn't seem to update until I do a number of restarts on the Development Server (using the Run or Debug buttons from Eclipse).
What am I doing wrong ?
The basic flow is:
Make change to .java file...
Save file
Run application (development server loading log shows in console)
Refresh web page in browser
P.S: The only way I can get it to work is to change the server port... and if I do that all the previous servers still show at their respective ports. They never stop.
You do need to restart the server to see most code changes you'll make. The easiest way to do this is with the yellow reload button that appears on the GAE pane - not the console, but the one that has the fancy "click here to launch" addresses.
If you do use the debug / run commands in eclipse, you will need to explicitly stop the previous run. You can do this from the debug menu (the stop button) or from the GAE pane or from the console pane.
You won't need to change the ports after this - the reason you have to do it now is that the first instance is still running, hogging the port. Once you stop it you'll be able to run it again on the same port... WITH your code changes! :)