Run launch file automatically in Eclipse - eclipse

I would like to have the possibility to run a .launch file without having to navigate to a project and folder and choose that file and right click and choose run.
It would also be nice if I could run tomcat without having to navigate to the server tab as you can see in screenshot
Is there any way I can do this?

.launch files are managed in Eclipse as Run configurations. Normally, .launch files present in an Eclipse project are automatically added to the list of run configurations for the project. These can be accessed through Run | Run Configurations... or using the run menu shortcut
If the launch files are not automatically detected when a project is first imported, running them once should allow Eclipse to detect them.

Related

Include Run Configurations in SVN project in MyEclipse

How can I configure MyEclipse and the SVN plugin (Subclipse 4.3.3) so that my Run Configurations are included in the source code control. Every time a new developer checks out the project, he doesn't have the Run Configurations needed to test the application properly or to do the Maven packaging correctly.
Is there a way?
To share your run/launch configuration, go to the launch configuration (Run > Run Configurations...) tab Common for Save as choose Shared file (instead of Local file).
In addition, you can choose to Display in favorites menu to add it to the drop-down of the corresponding button in the main toolbar.

Eclipse not automatically refreshing resources in src/main/resources

In my Eclipse preferences, I have "Refresh using native hooks or polling" selected.
If I make a change to a Java file outside of Eclipse, the project that contains that Java file automatically refreshes and rebuilds that file as it should. However, if I make a change to a file under src/main/resources/... from an external editor, it is not automatically refreshed. I have to select the project and press F5 to get it to refresh.
Is there a way to configure Eclipse to automatically refresh any resources under src/main/resources?
In Eclipse
Run > External Tools > External Tools Configuration
Create a new Program configuration Point the location to an exe that is very fast
On the Refresh tab, choose Refresh Resources upon completion, The Entire Workspace
On the Build tab, deselect Build before launch

Running ANT targets using .launch file

In one of my legacy project ant target is invoved from *.launch file. This file contains <launchConfiguration> tag and one of the attribute name "type" is ant class org.eclipse.ant.ANTLaunchConfigurationType, different parameter are set using this tag. When this launch file is executed in eclipse, one of the ANT target is executed specified in launchConfiguration tag.
I am not able to find any information around this functionality of ANT. Only relevant thread found is, which is unanswered
Running eclipse ant targets from an external command
I am not able to understand how launch files are created and how to set parameter to launchConfiguration tag.
The .launch files are created by Eclipse for every Run Configuration you want to be saved:
Open Eclipse.
Select a build.xml file.
Through the context menu, execute Run as/Ant build.... A dialog appears.
If you want to pass parameters to the Ant script, you have to fulfil the Arguments area (in the Main tab) like this:
-Darg1=value1
-Darg2=value2
...
Then, go to the Common Tab and focus on the Share file field: With the Browse button, select your project. This will create the .launch file into your project, and let it available for further executions. (You should rename it).
Execute Run.
You can edit the .launch configuration in menu Run>External tools>External tools configuration.
Note: Within the Run Configuration, you'd better spend some minutes reading all the parameters available in all the tabs. For example, in the Build tab, you can set if you want a project to be build before your script is executed (If not, unchecking the checkbox may save you a lot of time). Or in the Refresh tab, you can select which project directories you want to be refreshed after the script is executed, etc.
Launch configurations for Ant Builds are created and managed using the 'Run > External Tools > External Tools Configurations...' dialog.
You can import existing .launch files using 'File > Import... > Run/Debug > Launch Configurations'

image won't show in Eclipse dynamic web project

I have a folder containing images under WebContent. If I copy file 1.jpg to images using Windows Explorer, it won't show on my webpage:
document.getelementById("image1").src = "./images/1.jpg"
However, if I right click the project in Eclipse, refresh, then everything works.
How do I remove the need to refresh the project? The images are supposed to be generated by another program dynamically
If something outside of Eclipse modifies the workspace it is always necessary to do a refresh.
However you can configure Eclipse to do this automatically in Preferences > General > Workspace. Check the 'Refresh using native hooks or polling' option.
If the program generating the images is an Eclipse plugin it can use Eclipse APIs to create the files or do the refresh (a normal program cannot do this).
If you run the program using Eclipse Run External Tool configuration there is a Refresh tab that will let you set up the refresh to do when the program terminates.

Using ant in Netbeans problem

When I do: ant run from directory /home/me/workspace/OMI3/OperatorDisplays/
There is no problem.
In netbeans when I right click on build.xml in the same directory and select "run target", "run". Everything builds fine, but when running it seems that an evironment variable is not recognized.
Using System.getenv() I see that netbeans is running from /home/me, I want netbeans to run from /home/me/workspace/OMI3/OperatorDisplays
Thanks!
It seems you have to change the working directory for your project.
Go to the Properties screen of your project (File|Project properties (yourproject) menu or Properties in the project's contextual menu in the Projects tab).
Then in the Runcategory, you have a Working directory textfield. Put /home/me/workspace/OMI3/OperatorDisplays in it and it should work then.