您的位置:首页 > 编程语言 > Java开发

Eclipse launch configuration 一

2016-03-09 22:33 399 查看
1,launch configuration存放位置

${workspace}\.metadata\.plugins\org.eclipse.debug.core\.launches

2,关于launch configuration

使用Run >Run As >Java Application运行类时,使用的是通用的Java Application运行配置,它继承自Java工程和工作台的参数。在某些情况下,我们需要修改这些参数或额外指定运行参数。

可以通过如下步骤来创建[b]Java Application运行配置:[/b]

在工作台的菜单条中选在Run按钮,然后选择Run Configurations,弹出配置对话框,可以添加,修改或删除配置。



打开后的页面如下:



关于上面的各个tab的含义如下:
Main:定义要运行的类。在project选项中输入工程名字,在Main class选项中输入主类的完整类名。如果希望在debug模式运行时在main函数停顿的话,勾选Stop in main. 需要注意的是,工程名字不是必现的,添加后的好处是允许选择默认的classpath,source lookup path 和JRE。
Auguments:定义传输给应用程序和虚拟机(如果需要的话)的参数。还可以指定运行程序的工作目录。
JRE:定义运行或调试应用程序的JRE。可以选择已经定义的JRE 后定义一个新的JRE。
Classpath:定义运行或调试应用程序时使用到的class文件的位置。默认情况下,用户和引导程序类的路径都来自于相应工程的build path. 可以在这里改写这些设置。
Source: 定义调试应用程序时显示的源文件的路径。默认情况使用相应工程的build path. 可以在这里改写这些设置。
Environment:[b]定义运行或调试应用程序时使用到的环境变量。默认情况使用Eclipse的运行环境。 可以在这里改写或添加环境变量。[/b]
[b]Common:定义运行配置的通用信息。[/b]
各Tab的含义介绍原文如下:


Creating a Java application launch configuration

When you choose Run >Run As >Java Application to launch your class, you are running your class using a generic Java Application launch configuration that
derives most of the launch parameters from your Java project and your workbench preferences.  In some cases, you will want to override the derived parameters or specify additional arguments.
You do this by creating your own Java Application launch configuration. 
Select or from the workbench menu bar.  This opens a dialog that lets you create, modify, and delete launch configurations of different types.
Select Java Application in the left hand list of launch configuration types, and press the New button in the toolbar. This will create a new launch configuration for a Java application. The
tabs on the right hand side allow you control specific aspects of the launch.
The Main 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. Check
the Stop in main checkbox if you want the program to stop in the main method whenever the program is launched in debug mode.

Note:  You do not have to specify a project, but doing so allows a default classpath, source lookup path, and JRE to be chosen.
The Arguments 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.
The JRE 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.
The Classpath 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.
The Source 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.
The Environment 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.
The Common tab defines general information about the launch configuration.  You may choose to store the launch configuration in a specific file and specify which perspectives become active when the launch configuration
is launched.
http://www.ibm.com/developerworks/opensource/tutorials/os-eclipse-tools/
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  eclipse