| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| <html lang="en"> |
| <head> |
| <meta name="copyright" content="Copyright (c) IBM Corporation and others 2000, 2011. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." > |
| <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
| <meta http-equiv="Content-Style-Type" content="text/css"> |
| <link rel="STYLESHEET" href="../book.css" charset="ISO-8859-1" type="text/css"> |
| <title>Stand-alone external tools</title> |
| </head> |
| <body> |
| <h1>Stand-alone external tools</h1> |
| |
| <p>For the ultimate in external tool flexibility, create a 'stand-alone' |
| external tool launch configuration. This is similar to the project builder launch |
| configurations discussed in the last section, except that it need have nothing |
| to do with project building, and you can explicitly run it whenever you choose. |
| Suppose you wanted to have a way to quickly see the contents of a <code>.jar</code> file |
| in your workspace using the jar utility. </p> |
| <ol> |
| <li>Select some <code>.jar</code> file in your workspace.</li> |
| <li>Select <b>Run > External Tools > Open External Tools Dialog...</b> from the workbench |
| toolbar.<br><br> |
| <img src="../images/et_run_dropdown.png" alt="External tools drop-down menu" border="0" > |
| <br><br> |
| </li> |
| <li>Select <b>Program</b> in the tree, then click <b>New</b>.<br><br> |
| <img src="../images/et_standalone.png" alt="External tools dialog for jar inspector script" border="0" > |
| <br><br> |
| </li> |
| <li>Name the launch configuration <code>jar inspector</code>.</li> |
| <li>Use the first <b>Browse File System...</b> button to locate the jar executable.</li> |
| <li>In the <b>Arguments</b> field, type <code>-tvf</code> and a space, then click <b>Variables...</b>.</li> |
| <li>In the Select Variable dialog, you will see a number of variables you can |
| pass as arguments to the program specified in Location. Select <b>resource_loc</b> |
| and click <b>OK</b>. </li> |
| <li>When this buildfile is run, the absolute path of the resource selected in |
| the workbench will be passed to the jar utility in the position specified. |
| </li> |
| <li>Click <b>Run</b>.</li> |
| <li>Notice that the buildfile sends the jar utility output to the <b><a href="PLUGINS_ROOT/org.eclipse.jdt.doc.user/reference/views/console/ref-console_view.htm">Console view</a></b>.</li> |
| <li>Select a different <code>.jar</code> file in your workspace.</li> |
| <li>Click the External Tools button in the toolbar. Notice the contents of this |
| jar are sent to the <b><a href="PLUGINS_ROOT/org.eclipse.jdt.doc.user/reference/views/console/ref-console_view.htm">Console view</a></b> as well. |
| Now you have a quick and easy way to see the output of the jar utility for any <code>.jar</code> file in your workspace.</li> |
| </ol> |
| <p>This example has only scratched the surface of what you can do with external |
| tools. The important things to remember are that you can create an external |
| tool for anything you can run on your system, and that you can pass arguments |
| to the external tool related to the current workbench selection. In many cases, |
| this allows you to loosely integrate tools that do not have corresponding Eclipse |
| plug-ins. |
| </p> |
| |
| <h3 class="related">Related tasks</h3> |
| <a href="qs-82_create.htm">Creating Ant buildfiles</a><br> |
| <a href="qs-83_edit.htm">Editing Ant buildfiles</a><br> |
| <a href="qs-85_ant_configs.htm">Saving & Reusing Ant options</a><br> |
| <a href="qs-84_run_ant.htm">Running Ant buildfiles</a><br> |
| <a href="qs-93_project_builder.htm">Creating a project builder Ant buildfile</a><br> |
| <a href="qs-92_project_builders.htm">Ant buildfiles as project builders</a><br> |
| <a href="qs-94_run_pj.htm">Executing project builders</a><br> |
| <a href="qs-95_external_tools.htm">External tools</a><br> |
| <a href="qs-96_non_ant_pjs.htm">Non-Ant project builders</a> |
| |
| </body> |
| </html> |