}
try {
monitor.subTask("verifying installation");
String mainTypeName = Plugin.BOOTSTRAP_CLASS_NAME;
IVMRunner runner = getVMRunner(configuration, mode);
File workingDir = verifyWorkingDirectory(configuration);
String workingDirName = null;
if (workingDir != null) {
workingDirName = workingDir.getAbsolutePath();
}
// Environment variables
String[] envp = getEnvironment(configuration);
// Program & VM arguments
String pgmArgs = getProgramArguments(configuration);
String vmArgs = getVMArguments(configuration);
ExecutionArguments execArgs = new ExecutionArguments(vmArgs,
pgmArgs);
// VM-specific attributes
Map vmAttributesMap = getVMSpecificAttributesMap(configuration);
// Class paths
//here the classpath means for the Jetty Server , not for the application! by TonyQ 2011/3/7
String[] classpath = getClasspath(configuration);
//here the classpath is really for web app.
String[] webAppClasspathArray = getProjectClasspath(configuration);
String webAppClasspath = null;
{
StringBuilder sb = new StringBuilder();
for (int i = 0; i < webAppClasspathArray.length; i++) {
String path = webAppClasspathArray[i];
if (sb.length() > 0)
sb.append(File.pathSeparator);
sb.append(path);
}
webAppClasspath = sb.toString();
}
// Create VM configuration
VMRunnerConfiguration runConfig = new VMRunnerConfiguration(
mainTypeName, classpath);
runConfig.setProgramArguments(execArgs.getProgramArgumentsArray());
runConfig.setEnvironment(envp);
List<String> runtimeVmArgs = getJettyArgs(configuration);
runtimeVmArgs.add("-Drjrclasspath=" + webAppClasspath);
runtimeVmArgs.addAll(Arrays.asList(execArgs.getVMArgumentsArray()));
runConfig.setVMArguments(runtimeVmArgs
.toArray(new String[runtimeVmArgs.size()]));
runConfig.setWorkingDirectory(workingDirName);
runConfig.setVMSpecificAttributesMap(vmAttributesMap);
// Boot path
runConfig.setBootClassPath(getBootpath(configuration));
// check for cancellation
if (monitor.isCanceled()) {
return;
}
// stop in main
prepareStopInMain(configuration);
// done the verification phase
monitor.worked(1);
monitor.subTask("Creating source locator");
// set the default source locator if required
setDefaultSourceLocator(launch, configuration);
monitor.worked(1);
checkOldLauncher(configuration, launch);
// Launch the configuration - 1 unit of work
runner.run(runConfig, launch, monitor);
// check for cancellation
if (monitor.isCanceled()) {
return;