Can a "run configuration" ensure another app is running? - eclipse

When working with Mule ESB, we need to have (in our case) ActiveMQ running (in a terminal) or it won't work. That's fine, but I sometimes forget to start ActiveMQ, which caused me to wonder...
Can I somehow explain to my "Run configuration" that it should start an external program in conjunction with starting the run|debug session? And if so, can it be configured to only start it if it's not already running?

I am not sure whether you can run the external application using your project run configurations. But from mule studio you can start the external application using Run--> External tools. Refer the below kink for details
http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.platform.doc.user%2Ftasks%2Ftasks-exttools-running.htm

Eclipse CDT contains a useful type of launch configuration called a Launch Group. With a launch group you can set up different launches to run and what order. You can optionally add delays between launches (to allow for your service to start) or wait for a set up launch to terminate before running the next one.
To install the launch groups you can add "C/C++ Development Tools" to your installation.
Once installed, you should have a new launch type called a launch group.
Here is an example of one that may address your first question:
Launch Group Example
As my example shows, you don't need to have any CDT launches to be able to use Launch Groups.
As for your second part. This is in active development. Eclipse EASE is adding full scriptability to Eclipse and as it turns out I have just written a post about adding launching capabilities to the scripting. You can follow that work on bugzilla: Bug 478397

Related

Eclipse Launch Group: Stop if single launch configuration fails

We are having Maven projects relying on each other, which are built separately and included as dependencies. So to have a single button to compile all the intermediate steps, I use Eclipse Launch Groups. However when a single build fails, the Launch Group just goes on, which can be unrecognizable unless you control every single console instance.
Is there a way to stop the execution if a single step fails? Maybe Launch Groups are not the perfect fit and there is another tool for multiple Run Configuration executions?
By try-and-error I found the following solution, which works for our Maven builds: Chose as "Post launch action" "Wait for console output", and let it wait for "[INFO] BUILD SUCCESS". This pauses the execution of the launch group at the failed process, pointing you directly to the first occured error.
If you use other build setups or tools you have to check which string gets exclusively printed on build success.

Convenient way to run eclipse plugin

I have recently started developing an Eclipse plugin (which is basic stuff for now) and I am struggling with "default" way to run Eclipse plugin ("Run as Eclipse application").
The Eclipse is starting another instance with my plugin already installed in it (this is default behaviour).
The problem is that when I want to re-run my plugin project and I press "run" button again (or Ctrl + F11) (and the another Eclipse instance still running) I get following message:
"Could not launch the application because the associated workspace is currently in use by another Eclipse application".
The error makes sense, and when I close "testing" Eclipse instance I am able to run my plugin again.
The question is - "is it normal routine for plugin development?". Maybe I am missing something, e.g. special arguments for Eclipse?
This seems all pretty normal. The error message is since the run configuration is specifing a workspace and when you start a second instance using the same workspace it is locked and considered in use.
What I usually do when testing a plugin is to create a run configuration (click "Run...") where I disable all the plugins I wont need when testing. This makes sure that the test starts up a couple of seconds quicker. Make sure you save that run configuration as a *.launch file aswell, that makes it quicker to test the next time. Or it can be used to share the configuration.
There's a lot you can configure in the run configuration, such as eclipse arguments, vm argument, if you want environment variables set, etc. So be sure to experiment a little.
In your run configuration. Main tab->Workspace Data ->Location text box add this:
${workspace_loc}/../runtime-EclipseApplication${current_date:yyyyMMdd_HHmmss}
Note the suffix ${current_date:yyyyMMdd_HHmmss} by this every time you launch your application new workspace will be created. So you will not get any error message saying workspace is locked.
But be careful as the folder .metadata will be different for different instances as their work-spaces are different. Thus preferences stored/retrieved by different instances are NOT in sync.
You are probably missing one important point: Eclipse supports the Java hot code replacement. Therefore in many cases you can modify your Java code while your application Eclipse instance is running, save the code and continue without restarting.
If hot code replacement is not possible, Eclipse will tell you, so you always know whether the editing changes are applied to the running instance.
This works best with more recent versions of the JVM, so consider upgrading to the latest Java 7 version, even if you write code to be compliant with Java 1.5 or 6.

Eclipse : Whether to select Local Or Shared File during Remote Debugging

I have made some code changes and deployed the code to Jetty Server which is located Remotely .
Accessed the application through browser and I am trying to debug a Application .
Please tell me whether i need to select the Local File Or Shared File from the Eclipse Debug Configurations .
Please see the screen shot here .
The option shown in your screenshot will not help you automatically get code deployed to your remote Jetty.
The option simply allows you to Share your launch configuration (Remote Java Application - ManageWatchlistCall) in your eclipse workspace. This will allow you to checkin the launch configuration in a versioning control system so your colleagues automatically get the sme Remote Java Application launch configuration.
in order to get new code to your remote server, there are only 2 options :
Redeploy your application on the remote server.
Hotdeploy pieces of code to the remote supported (if the server supports it)
Use Hotswap Bug Fixing (works for small fixes) (*)
(*) If you are running Java Virtual Machine (JVM) V1.4 or higher,
Eclipse supports a feature called Hotswap Bug Fixing (not available in
JVM V1.3 or lower). It allows the changing of source code during a
debugger session, which is better than exiting the application,
changing the code, recompiling, then starting another debugging
session. To use this function, simply change the code in the editor
and resume debugging.

Passing proxy settings to a bundled JRE install4j application?

We provided an application installed with install4j, with bundled JRE, to one of our customers. This customer needs some proxy settings configured manually for this application.
I tried to put deployment.config file in the JRE's lib directory but it didn't seem to change anything. I couldn't find a relevant vmoptions either.
Is there a way to pass these settings to the app/jre?
Is there also a way to instruct the JRE to open the Java console when it runs?
Thanks!
/Shmulik.
You can configure the proxy by setting the VM parameters
proxySet=true
proxyHost=...
proxyPort=...
and for authentication
proxyAuth=true
proxyAuthUser=...
proxyAuthPassword=...
You can set them either in a "Run script" in the startup node of the installer action by calling System.setProperty() for the properties or by passing them on the command line like this:
-DproxySet=true -DproxyHost=... etc
As for your second question (better to ask a separate question on stackoverflow)
Is there also a way to instruct the JRE to open the Java console when it runs?
I assume you mean a terminal window, which can be done by selecting the "Windows console executable" property of the installer. You cannot change this property on the command line because this sets a static flag in the binary format of the Windows executable furing compilation.
I created an installer for WINDOWS as well as for MAC. The
application is using an embedded JRE. While the application runs, it's not
able to detect the proxy settings of the network even the option in
the browser is set to be "Auto Detect". But when the proxy settings provided explicitly in the browser, it's able to detect the proxy settings.
Even the proxy settings are not detected when "LAN Settings->Use automatic configuration script" option is selected and points to the .pac file.
Any suggestion, how to provide the proxy settings with BUNDLED JRE and java program can detect those settings without make any further changes in each machine.

How can I bind a specific key to different launch configurations in Eclipse?

I have several launch configurations for the code I work on.
One configuration (#1) means "run the unit tests for the file in the frontmost editor (i.e. selected resource)". I would really like to be able to always make this be bound to a key.
Another configuration (#2) means "run the server that I am working on (in the frontmost project) so I can test it interactively".
Yet another (#3) means "run some automated acceptance tests against the server".
I always want to have #1 close at hand, easy to run from a single keystroke. Plus, I want to be able to run #2, watch it start up in a console, and when it's ready (since it's not entirely trivial to automate this) hit the key for #3.
This is possibly similar to the question for binding a key to a specific build configuration, but the answers there look very specific to builds, and as I'm using PyDev, I don't have a "build" step at all.
Also, given that I'm using PyDev, an answer in the form of a pyedit_* script would be appreciated just as much as a "native" answer for eclipse.
Maybe Eclipse Runner plugin could make it easier for someone to handle launch configurations. It doesn't allow to assign key binding to launch configurations currently but I opened a feature request Key bindings for launch configurations
Not to a specific launch Configuration , but you can bind a key to run Last run Configuration ,
Windows->preferences->General->Keys->Run last launched external Tool
You can do the following (for #2 and #3), after having those run configurations created:
Go to Run > Run Configuration > Select the run configuration you want > Common > Display in Favorites Menu > Check Run/Debug. This will make it always appear as the first on the menu.
This will make it appear in the menu in Run > History and Run > Debug History, then, you can access it through Alt+R, T, 1 (and 2 and 3) to run your configurations or Alt+R, H, 1 (and 2 and 3) to debug.
And for #1, as Piotr Dobrogost said, you can just use Ctrl+F9 in the current editor and choose which test-cases you want to run (if you select a unit-test -- usually with Ctrl+Shift+Up or Ctrl+Shift+Down -- it'll be pre-selected for you) -- then, if you configured to always relaunch the last launch, as explained in http://www.pydev.org/manual_101_run.html, you can use Ctrl+F11 to relaunch the last launch.