http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.jdt.doc.isv%2Fguide%2Fjdt_api_run.htm
http://camel-route-viewer.googlecode.com/svn-history/r136/trunk/src/com/googlecode/camelrouteviewer/launcher/CamelLaunchShortcut.java
Running a Java program
The JDT Debug component includes facilities for launching a Java program using the VM install that is currently configured by the user for a Java project.
Launching a compiled Java program
Java programs that have been compiled in a Java project can be run by getting the appropriate IVMRunner for the Java project and running the class by name. The following code snippet shows how the class MyClass inside myJavaProject can be launched.
IVMInstall vmInstall = JavaRuntime.getVMInstall(myJavaProject);
if (vmInstall == null)
vmInstall = JavaRuntime.getDefaultVMInstall();
if (vmInstall != null) {
IVMRunner vmRunner = vmInstall.getVMRunner(ILaunchManager.RUN_MODE);
if (vmRunner != null) {
String[] classPath = null;
try {
classPath = JavaRuntime.computeDefaultRuntimeClassPath(myJavaProject);
} catch (CoreException e) { }
if (classPath != null) {
VMRunnerConfiguration vmConfig =
new VMRunnerConfiguration("MyClass", classPath);
ILaunch launch = new Launch(null, ILaunchManager.RUN_MODE, null);
vmRunner.run(vmConfig, launch, null);
}
}
}
Another way to launch a Java program is to create a Java application launch configuration, and launch it. The following snippet shows how the class MyClassinside myJavaProject can be launched using a simple launch configuration. By default, the resulting running application uses the JRE and classpath associated with myJavaProject.
ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
ILaunchConfigurationType type = manager.getLaunchConfigurationType(IJavaLaunchConfigurationConstants.ID_JAVA_APPLICATION);
ILaunchConfigurationWorkingCopy wc = type.newInstance(null, "SampleConfig");
wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, "myJavaProject");
wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, "myClass");
ILaunchConfiguration config = wc.doSave();
config.launch(ILaunchManager.RUN_MODE, null);
分享到:
相关推荐
Start Small, Stay Small is a step-by-step guide to launching a self-funded startup. If you're a desktop, mobile or web developer, this book is your blueprint to getting your startup off the ground ...
电子商务英文课件:ch15 Launching a Successful Online Business.ppt
Entrepreneurship Successfully Launching New Ventures
Eclipse is more of a tools platform than a tool itself, Eclipse's launching capabilities depend entirely on the current set of installed plug-ins. This article describes the framework available to ...
MicroBlaze常见问题汇总,用Xilinx的朋友可以管住下
This program requires Java 1.8+Make sure you install the required Java version.” 可以进入安装的 JD-GUI.app, 右键显示包内容,进入 Contents,大家 info.plist, 找下 如果里面有 1.8+ ,改成 1.8 即可
Understanding the Overheads of Launching CUDA Kernels.pdf
* Decompiler can be used to reproduce Java source code from compiled Java class file. It uses debug information to produce Java code which is nearly the same as original source file. Nevertheless...
去CSDN下载所谓破解出现以下错误:wrapper | Licensed to (null) for (null) wrapper | wrapper | Launching a JVM... jvm 1 | WrapperManager: Initializing... jvm 1 | WrapperJNI Error: Not licensed to use ...
实用开发工具Myeclipse,在启动tomcat时,不间断的会弹出 An internal error occurred during: "Calculating completion proposals...". java.lang.NullPointerException的错误对话框!
描述了windows中常见的故障、问题及其解决办法。
JWS是与网络浏览器相结合的应用软件,当用户点击链接的时候就会指向一个Java网络启动协议(Java Network Launching Protocol (JNLP) )文件,然后浏览器自动启动JWS,接着下载、缓存并运行基于Java技术的应用软件。...
prof-t07-the-untold-stor-of-8200-a-launching-point-for-women-in-cybersecurity_title_apply_slides AI 数据分析 数据安全 数据安全 应急响应
org.eclipse.jdt.launching_3.7.102.v20141111-0953.jar org.eclipse.jdt.ui_3.10.2.v20141014-1419.jar org.eclipse.jdt_3.10.1.v20150204-1700.jar org.eclipse.m2e.jdt.ui_1.5.1.20150109-1820.jar org.eclipse.m...
JAVA music player. Project Homepage : http://www.javazoom.net/jlgui/jlgui.html Developer Homepage : http://sourceforge.net/project/?group_id=1344 -----------------------------------------------...
Matlab class for launching and managing asynchronous processes.zip
下列包的参考文档,从源码生成的。 org.eclipse.jdt.core org.eclipse.jdt.debug org.eclipse.jdt.junit org.eclipse.jdt.launching org.eclipse.jdt.ui
2.3 Modularizing a simple paint program 28 2.4 Introducing bundles 31 The bundle’s role in physical modularity 32 ■ The bundle’s role in logical modularity 33 2.5 Defining bundles with metadata 34 ...
解决myeclipse10运行出现:CreateProcess error=87, ²ÎÊý´í 的问题,直接替换myeclipse安装路径\Common\plugins