blob: 8be90ade52527f38836c7d440bb7af0efadda509 [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xml: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=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<link rel="stylesheet" href="../book.css" charset="ISO-8859-1" type=
"text/css" />
<title>
Creating a Java application launch configuration
</title>
<script language="JavaScript" src=
"PLUGINS_ROOT/org.eclipse.help/livehelp.js" type="text/javascript">
</script>
</head>
<body>
<h1>
Creating a Java application launch configuration
</h1>
<p>
When you choose <strong>Run &gt;Run As &gt;Java Application</strong> to
launch your class, you are running your class using a generic
<strong>Java Application</strong> launch configuration that derives most
of the launch parameters from your Java project and your workbench
preferences.&nbsp; In some cases, you will want to override the derived
parameters or specify additional arguments.
</p>
<p>
You do this by creating your own <strong>Java Application</strong> launch
configuration.&nbsp;
</p>
<ol>
<li>Select <a class="command-link" href=
'javascript:executeCommand("org.eclipse.debug.ui.commands.OpenRunConfigurations")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.svg" alt=
"Opens the Run Launch Configurations dialog" /> <strong>Run &gt; Run
Configurations...</strong></a> or <a class="command-link" href=
'javascript:executeCommand("org.eclipse.debug.ui.commands.OpenDebugConfigurations")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.svg" alt=
"Opens the Debug Launch Configurations dialog" /> <strong>Run &gt;
Debug Configurations...</strong></a> from the workbench menu bar.&nbsp;
This opens a dialog that lets you create, modify, and delete launch
configurations of different types.
</li>
<li>Select <strong>Java Application</strong> in the left hand list of
launch configuration types, and press the <strong>New</strong> button in
the toolbar. This will create a new launch configuration for a Java
application.&nbsp;The tabs on the right hand side allow you control
specific aspects of the launch.
</li>
</ol>
<blockquote>
<ul>
<li>The <strong>Main</strong> tab defines the class to be launched.
Enter the name of the project containing the class to launch in the
project field, and the fully qualified name of the main class in the
Main class field.&nbsp;Check the <strong>Stop in main</strong> checkbox
if you want the program to stop in the main method whenever the program
is launched in debug mode.<br />
Note:&nbsp; You do not have to specify a project, but doing so allows
a default classpath, source lookup path, and JRE to be chosen.
</li>
<li>The <strong>Arguments</strong> tab defines the arguments to be
passed to the application and to the virtual machine (if any). You can
also specify the working directory to be used by the launched
application.
</li>
<li>The <strong>JRE</strong> tab defines the JRE used to run or debug
the application. You can select a JRE from the already defined JREs, or
define a new JRE.
</li>
<li>The <strong>Classpath</strong> tab defines the location of class
files used when running or debugging an application. By default, the
user and bootstrap class locations are derived from the associated
project's build path. You may override these settings here.
</li>
<li>The <strong>Source</strong> tab defines the location of source
files used to display source when debugging a Java application. By
default, these settings are derived from the associated project's build
path. You may override these settings here.
</li>
<li>The <strong>Environment</strong> tab defines the environment
variable values to use when running or debugging a Java application. By
default, the environment is inherited from the Eclipse runtime. You may
override or append to the inherited environment. Variables specified in
the tab always replace values in the underlying native environment.
However, when "Append environment to native environment" is selected
the launched environment is seeded with the native environment, after
which variables in the tab replace (existing variables) or augment the
set of environment variables. When "Replace native environment with
specified environment" is selected, the launched environment is
comprised only of the variables specified in the tab.
</li>
<li>The <strong>Common</strong> tab defines general information about
the launch configuration.&nbsp; You may choose to store the launch
configuration in a specific file and specify which perspectives become
active when the launch configuration is launched.
</li>
</ul>
</blockquote>
<h3 class="related">Related concepts</h3>
<a href="../concepts/cdebugger.htm">Debugger</a><br />
<a href="../concepts/clocdbug.htm">Local debugging</a>
<h3 class="related">Related tasks</h3>
<a href="task-choose_config_jre.htm">Choosing a JRE for launching a
project</a><br />
<a href="task-launching_java_program.htm">Launching a Java
program</a><br />
<a href="tasks-executionArgs.htm">Setting execution arguments</a><br />
<a href="../tasks/tasks-9.htm">Changing debugger launch options</a>
<h3 class="related">Related references</h3>
<a href="../reference/preferences/run-debug/ref-run_debug.htm">Debug
preferences</a><br />
<a href="../reference/views/debug/ref-debug_view.htm">Debug
view</a><br />
<a href="../reference/menus/run/ref-menu-run.htm">Run Menu</a>
</body>
</html>