How to restart Eclipse with bat - eclipse

Most Eclipse applications have File -> Restart in their menus. Is it possible to restart application with some bat script in Windows?

Try the following:
Kill the eclipse process
taskkill /im eclipse.exe
Wait a few seconds until the process is terminated
sleep 10
Start the eclipse application
start "C:\eclipse\eclipse.exe"

No, that's generally not possible without bad side effects. The code to restart Eclipse is several hundred lines of Java code, carefully creating a new virtual machine process with all the right settings.

Related

Run a local command before starting eclipse debugging

I want to run a terminal command just before a debug configuration starts on Eclipse.
I heard about CDT launch Groups, but couldnt get around it fully. I need to just run a normal terminal command, nothing fancy.
The aim is to copy some stuff over to the execution path before actually starting the debugging.
I managed to do this via "Launch Groups" in the CDT. Creating 2 groups, one as a c/C++ Application which calls a shell script that includes the command I want to run. And then the normal debug configuration I wanted to execute.

jEdit 5.4 Windows 7 Install error: Thinks a jEdit session is open when it is not

I have been running jEdit 5.3 for about 1.5 years with no significant problem. On 2017-07-03 I used it and it worked fine. On 2017-07-04, it would not start. jedit and javaw exe's were created, but the jEdit window did not display. I uninstalled version 5.3 and tried to install version 5.4 and got this error:
"The installer will now try to quit a running instance of jEdit.
Please save your work and exit jEdit for the installation to continue."
When I continue, the installer freezes. The same happens if I try to install version 5.3. I did not have a running instance, but the installer thought that I had one. I am guessing that something went wrong with jEdit when I shutdown on the 3rd. (I always intend to close all apps before I shut down, it is possible that I forgot to shutdown jEdit.)
Does anyone know how to tell windows 7 to get rid of this phantom instance of jEdit. I am using a backup version of jEdit 4.5.2 for the time being. So, I can continue with my work. I am guessing that this phantom instance also caused the jEdit 5.3 startup problem that I had before the uninstall.
2017-07-15 Update: I tried installing jEdit 5.4 on Saturday and it worked! On my previous try, when I got the 'running instance' warning I stopped, because every other time I continued at the point the installation froze. On Saturday, I tried continuing after the warning, and it worked! My thanks to Ross Rogers and Mr. Vampire for taking the time to give me expert advice. Renaming the roaming jedit file apparently was effective. I am guessing that deleting the server file would have helped also.
The most likely cause is a stale server file that points to some other process. jEdit and the installer talks to running instances via the network (TCP) on a port that is opened randomly and written to the server file in your settings directory. If you do not quit jEdit cleanly (e. g. only close the window without using the file menu or the shortcut to completely quit jEdit when the jEdit server is running), then jEdit on next start (or the installer) finds the server file and tried to talk to the process listening on the port written in the file. If there is no process listening, it is assumed that the server file is stale and a new instance of jEdit is started. Unfortunately jEdit is not as grateful if there is some process listening on that port but is not answering, jEdit just waits forever currently. This definitely needs to be improved and I think there is also a ticket for this. Try to delete the server file in your settings directory, by default it is %APPDATA%/jEdit/server on Windows and then try to start jEdit or the installer again.
I had to add /SUPPRESSMSGBOXES. /VERYSILENT wasn't silent enough. /? doesn't tell you what the options are.
https://www.itninja.com/software/contributors/jedit-1/4-2570

Tomcat hangs and prevents Eclipse from shutting down after running some time

I'm running Eclipse 4.6.1 with in-IDE Tomcat 8.5.6 on Windows 10 Professional 64-bit Anniversary Edition.
After Tomcat is left running in Eclipse after some time, the Tomcat embedded in Eclipse can no longer be stopped. I press the red "Stop" button in the "Servers" tab, but nothing happens. Eventually Eclipse will ask me if I want to terminate Tomcat:
Server Tomcat v8.5 Server at localhost is not responding. Do you want to terminate this server? Click OK to terminate the server or click Cancel to continue waiting.
I click "OK to terminate the server... but Tomcat keeps running.
Unfortunately when I then try to close Eclipse, it hangs on "Saving workbench state." Finally I have to kill Eclipse, thereby losing my workbench state. Even worse, if I then start Eclipse back up and try to restart the embedded Tomcat, I get the following error:
'Starting Tomcat v8.5 Server at localhost' has encountered a problem.
Several ports (8005, 8080, 8009) required by Tomcat v8.5 Server at localhost are already in use. The server may already be running in another process, or a system process may be using the port. To start this server you will need to stop the other process or change the port number(s).
How can I surgically go in and really kill Tomcat so that it doesn't hang Eclipse and keep ports open? (Unfortunately the only thing that shows up in the task manager is Eclipse.exe. There is no Tomcat to be seen. I've tried killing the javaw.exe subprocess, but that doesn't help.)
(At one point I thought this was related to a VPN connection going down, but today this happened with no VPN connection at all.)
I've filed Eclipse Bug 511342. We'll see if anything comes of it.
i've tried locally but i couldn't recreate the bug .
im not sure that this answers your question but it is for sure something worth trying , in any case this might show some features to other users....
in the window menu you have the SHOW VIEW , there you can choose other
this open the future window with search bar and all the available views for the ide .
in the debug view , you can do actions not only on applications , but on servers also . the menu here is different from the view you see in the server, and you can do advanced termination other things.
welp , hope that helps .
*note , you don't need the server to run in debug mode .
Find your Tomcat installation directory, navigate to bin folder, open a command window there and execute an .bat file named shutdown.bat, this way you can kill tomcat directly, make sure to locate the appropiate Tomcat installation directory which Eclipse is using.
UPDATE - Expected output:
I have not used it in the same way you have, but this may help.
On a command prompt (Cmd.exe) execute:
netstat -a -o | find "8080"
That will list all IP/PORT in use alongside the PID (process id) filtering by port # 8080 (change it to meet your needs or remove the find if you want to list all)
Open Task Manager, and using the PID you should be able to find the particular
process that is using the ports you need to release.
updated:
Once you find the port (8080) you can try using the command
taskkill /f /pid [port number]
Found a related issue with this command: Stack overflow - Tomcat not shutting down eclipse
Again, I use this when I need to find a rogue thing that I need to kill, and I don't know if the embedded environment will show it separate but its worth a try.
In tomcat's console inside Eclipse, there's a red button that can stop it. Albert also stated that in task manager it appears as javaw.exe, however Eclipse itself also appears as javaw.exe, so be careful when killing each one. Eclipse should be the one that takes more memory.

"Terminate" in eclipse's console view leaves node.exe running

I recently started developing for Node.js/Express with Nodeclipse. I added a run configuration for package.json with goal start. This works as expected, the start command from package.json is executed (node ./bin/www). I can see this command in Eclipse's console view and I can see two node.exe processes appear in Windows Task-Manager. HTTP requests to http://localhost:3000/ are logged in the console.
However, klicking the red "Terminate"-Button in Eclipse's console view leaves the node.exe processes running. Subsequent attempts to start the app fail because the port is already in use.
I do not have this problem when I start the app with npm start in Windows cmd. Stopping the execution with Ctrl+C will also exit the node.exe processes.
This is my IDE-Setup:
Eclipse Luna SR2 (4.4.2) under Windows 7 x64 with jre1.8.0_45
Eclipse was setup this way: extracted eclipse-platform-4.4.2-win32-x86_64.zip (from here), installed Eclipse Marketplace Client, then installed Nodeclipse via Drag&Drop from nodeclipse.org
Node.js version v0.12.2 (for Windows x64)
express-generator (version 4.12.1) is installed globally
How can I make the Terminate button in the console view actually terminating the node.exe processes?
It seems that Eclipse only kills the npm script that is used to start up node. The thing is that Eclipse forcibly kills that script, giving it no chance to send any signals to the node.exe process.
This bug explains why this works this way.
Step 1:
Run command-line as an Administrator. Then run the below mention command. type your port number in yourPortNumber
netstat -ano | findstr :yourPortNumber
Red coloured circled area shows the PID (process identifier)
Step 2 :
Then you execute this command after identify the PID.
taskkill /PID typeyourPIDhere /F
P.S. Run the first command again to check if process is still available or not. You'll get empty line if process is successfully ended.

Run Tomcat within Eclipse as a different user

I am running Eclipse Indigo EE on Windows 7, logged in as me.. I have Tomcat running within eclipse right now (under Servers view) but it's running under my user. I'd like to run it as a different user. How do I go about achieving that? I don't want to run it as a Windows service or outside of Eclipse, I want to continue to manage it through Eclipse which makes debugging, shutting down, starting up a lot simpler for me.
Any ideas how to go about setting that up or if it's even possible?
Thanks
I could not find a way to start the Tomcat server as a different user. Whereas you can achieve this by opening eclipse as a different user. Following are the steps for the same
Open command prompt.
Run following command with intended user name and eclipse exe's location
runas /user:domainName\userName C:\eclipse-jee-mars-R-win32-x86_64\eclipse\eclipse.exe
Thanks,
Sabeer