Restart Eclipse application - eclipse

How can I restart an application in Eclipse through a socket call?
I built an error diagnosis app which can checks what code should be changed to handle the error, but after the change I have to restart the app again. I already have developed a plugin for Eclipse which would take care of this, but I am not sure on how to restart the app.
1.) Is there an internal Eclipse command to restart the app?
2.) Do I have to use a command shell (which I wouldn't prefer)?
Hope someone can help me or give me some guidance. Also I know that there is a possibility to restart an app for debugging, but I want to run the app without debugging.

If you mean you have an Eclipse 3.x style RCP application and you want to restart the RCP from an Eclipse plug-in then you just do:
PlatformUI.getWorkbench().restart(true);
which restarts the RCP using the current workspace.
For an e4 RCP you do:
#Inject
IWorkbench workbench;
workbench.restart();

#greg-449: Thanks for your respond, but what I am trying to achieve is a bit more complex. Consider the following, I have a service that runs on another machine in my company network. It turned out something wrong is going with this service. So you can connect with with a remote debugger to the server and can check with the source code, that you have on your local machine, what is going on. I would say the classic Remote Debugging in Java.
But when you have fixed the error in the code you also have to restart the service on this other machine somewhere in the network. The question is how to do this? By a shell command which gives you the instances on this machine where the service is running or is there some other possibility?
Hope this helps more to understand the problem.

Related

Cannot debug project after upgrading to Service Fabric SDK v2.3.301

Recently upgraded to Service Fabric SDK v2.3.301, but for some reason my project got corrupted. I cannot debug the project, I get the following error: "A project with an Output Type of Class Library cannot be started."
It seems that the solution now fails to recognize the Service Fabric App. Yet I am able to deploy to my local cluster.
Anyone had similar issues while upgrading to the new SDK?
Thanks
PS Just in case, the service fabric app is the already set as startup project :o)
We have been using Service Fabric to develop a product for about a year with various versions of the SDK and I see this frequently. It happens both when hitting F5 with the SF Application as the sole startup project and even when right-clicking the SF Application and choosing "Debug -> Start New Instance".
Sometimes I have to try several times before it finally works. Other developers in our team see this as well, going all the way back to v2.0.
One thing that seems to make it happen less frequently is not touching anything on your computer after launching the project. Don't click anything else. Don't select another window. Let go of the mouse. Don't touch the keyboard.
Something I've started doing on the advice of a colleague is choosing "Debug -> Start Without Debugging", then attaching to the process if I want to debug it. I've had better luck with this approach in general - including not getting the "A project with an Output Type of Class Library cannot be started" issue.
I hope that helps.
I have had the same issue a couple of times. I have not been able to identify the source. But I have solved it with the following actions:
Close all Visual Studio windows.
Restart the Service Fabric service: Type services.msc in the windows run tool. Find Microsoft Service Fabric Host Service. Right Click + Restart.
Reset the local cluster: Look at the Service Fabric Local Cluster Manager Icon in the notification area in the right side of the task bar. Right Click + Reset Local Cluster.
Open the problematic solution in Visual Studio.
Clean and Rebuild solution.
Finally run your solution (press F5).
Hope this helps.
The error indicates that the service fabric application project (*.sfproj) is not set as start up project. Please try to change the start up project as some other project and again change it back to service fabric application project and see if that resolves the issue.

Eclipse IDE remote rebug and remote edit a legacy webapp

I am in a bind here, what's happening is I have a legacy webapp which uses an in-memory database. The app requires 64GB of RAM just to launch and it takes at least 30 minutes to start.
I have to make updates/fixes to this application. Obviously it is impossible to launch it on my PC so everything has to be done on the server. I have considered setting up an Eclipse IDE on the Linux server where this app runs, but that introduces a set of new issues. I really would like to continue using my PC's Eclipse IDE and make edits to the app.
I am able to use the remote debugging capabilities of Eclipse IDE and launch this app from the linux server no problem. However this is not enough. After I make an edit, I need to be able to save/compile the file, and load this change into the server relatively quickly. I can't wait 30 minutes every time I make some updates to the app.
Can anyone recommend ideas on what to do in this scenario? Ideally I would love to be able to launch the app in DEBUG mode inside the Linux Eclipse IDE on the server and connect to this instance using remote debugging from my local/Windows IDE. I would like to make changes in my Windows Eclipse IDE and then quickly copy the files over to the linux server, pick them up in the Linux Eclipse IDE, compile them in the Eclipse IDE instance running in debug mode, and effectively "hot swapping" the changes, thereby avoiding the need to wait 30 minutes for the app to start back up... However when I try to do this, there is a caveat... I can't seem to be able to launch the webapp in Linux Eclipse IDE in both DEBUG mode and also remote-debug-connect to it, the error I am getting in Eclipse is:
"Cannot load this JVM TI agent twice"
I get what is going on: the local debugger is launching tomcat with the -agentlib:jdwp parameter and on top of it, I am trying to force it to also start up with the same arguments and so it complains, but is there some way to trick it into allowing me to remote connect into this debug session from my Windows server?
I managed to solve this issue by updating Tomcat's context.xml to support reloadable mode:
<Context reloadable="true">
And in the app to set it to reloadable in WEB-INF/web.xml:
<web-app reloadable="true">
Now I am able to make edits in my local windows Eclipse IDE, Save them, and they automatically get updated on the server side.

Cannot deploy my updates to cloudfoundry

I have a simple app running on tomcat (using Postgresql). I deployed it to the Cloud-Foundry using the STS plugin and it runs OK. Recently I've encountered serious compilation problems (related to JS and JQuery) which led me to re install my STS. Now, when I run the app locally it runs perfect but when I use "Update & Restart" nothing happens - my new updates are not deployed! (I'm connected and Start/Stop works). I don't have a clue for how to tackle this. Please help.
Since you have reinstalled your STS, I would suggest you delete your app from Cloud Foundry and deploy your project from STS again. It might be because your project is not being linked with the app you have on cloudfoundry.com
Try that and let us know how it goes.

Launching from Eclipses causes errors in browser

I've got a strange situation; when I run a Flex app from Eclipse (i.e. click run as web app), my remote calls always hang.
In Firefox, they return as failed.
But when I open up a browser and browse to my .html file in the bin-debug folder, the remote calls work.
Why is that?
Thanks for any helpful tips!
p.s. I'm accessing a websphere server and authentication is required but a Java developer hardcoded his ID in.
One thing to check:
Do you have a breakpoint set in your code somewhere? Eclipse may be waiting for you to interact with it so the program execution can continue. On my Win7 machine, when the debugger takes over, eclipse often does not take over focus; so I have to manually minimize IE.
My problem was solved today and the issue was getting through to the IBM websphere server; the authentication was still in place and the java developers had to create a cloned environment where authentication was not required. Thank you everyone for their helpful answers.

eclipse howto start a application client on java ee glassfish appl srv

i have installed the glassfish eclipse tools bundle...
i can start a project like dynamic web & a ear project and deploy them on the glassfish... it works perfect & under the localhost url i will get an hello world
but how i do this if i want to make an application client. please help...
at the moment i simply created an "app client project in eclipse" & added it to the same ear,
but i have no idea how to start this...
help - any tutorial how to start?!!
Not the only only answer to this question but the appclient approach mentioned in Jeff's answer is a viable approach, but I was able to execute a client using this mechanism in eclipse and I wanted to share that approach.
This approach will let you execute a java application with a main method acting as a client.
What you want to do is setup an External Tools Configuration.
Create a new Program type of external tool configuration.
Set location to point to the path of the appclient, for me
(using embedded glassfish eclipse plugin) it was [PATH TO ECLIPSE]\plugins\oracle.eclipse.runtime.glassfish_3.1.1.0\glassfish3\glassfish\bin\appclient.bat
Set working directory to your output/build directory e.g.
${project_loc}/target/classes
Set arguments to ${java_type_name}
Select the class in your project with a main method that you wish to run as the client app and then select your external tool from the run external tools menu.
There are two ways to do it. I'm afraid I can't be very specific, but I can point you in the right direction. (I'm just learning myself)
You can enable Web Start for the application client EAR in GlassFish. You can do this either in the deployment descriptor (so it's enabled every time you deploy) or you can go into the GlassFish admin console, navigate to the Application, and check the checkbox to enable it. I have made a little progress on this approach.
You can run it manually from the command line using, I believe, the "appclient" command. I have not been able to get this working yet.
Good luck, and if you learn more, I'd appreciate it if you let me know since I'm in the same boat as you.
Jeff