/** Create the configuration for the virtual machine. * * @param monitor the progress monitor. * @throws CoreException if a parameter cannot be extracted. */ protected void createRunConfiguration(IProgressMonitor monitor) throws CoreException { monitor.subTask( Messages.SARLLaunchConfigurationDelegate_4); final VMRunnerConfiguration cfg = new VMRunnerConfiguration(getMainTypeName(), getClasspath()); cfg.setProgramArguments(getExecutionArguments().getProgramArgumentsArray()); cfg.setEnvironment(getEnvironment()); cfg.setVMArguments(getExecutionArguments().getVMArgumentsArray()); cfg.setWorkingDirectory(getWorkingDirectory()); cfg.setVMSpecificAttributesMap(getVirtualMachineAttributes()); cfg.setBootClassPath(getBootpath(this.configuration)); setVirtualMachineRunnerConfiguration(cfg); }
for (int index= 0; index < vmArguments.length; index++) arguments.add(vmArguments[index]); String[] bootClassPath= configuration.getBootClassPath(); final String[] classPath= configuration.getClassPath(); String[] combinedClassPath= null; LibraryLocation[] locations= null; arguments.add(flattenClassPath(combinedClassPath)); arguments.add(configuration.getClassToLaunch()); final String[] programArguments= configuration.getProgramArguments(); for (int index= 0; index < programArguments.length; index++) arguments.add(programArguments[index]);
private String debugConfig(VMRunnerConfiguration config) { StringBuilder sb = new StringBuilder("Launching:"); sb.append("\n Classpath: " + join(config.getClassPath())); sb.append("\n VMArgs: " + join(config.getVMArguments())); sb.append("\n Class: " + config.getClassToLaunch()); sb.append("\n Args: " + join(config.getProgramArguments())); sb.append("\n"); sb.append("java " + join(config.getVMArguments()) + " -classpath " + join(config.getClassPath(), ":") + " " + config.getClassToLaunch() + " " + join(config.getProgramArguments())); return sb.toString(); }
/** * Creates a new debug target for the given virtual machine and system process * that is connected on the specified port for the given launch. * * @param config run configuration used to launch the VM * @param launch launch to add the target to * @param port port the VM is connected to * @param process associated system process * @param vm JDI virtual machine * @return the {@link IDebugTarget} */ protected IDebugTarget createDebugTarget(VMRunnerConfiguration config, ILaunch launch, int port, IProcess process, VirtualMachine vm) { return JDIDebugModel.newDebugTarget(launch, vm, renderDebugTarget(config.getClassToLaunch(), port), process, true, false, config.isResumeOnStartup()); }
VMRunnerConfiguration runConfig = new VMRunnerConfiguration(mainTypeName, getClasspath(configuration)); runConfig.setProgramArguments(execArgs.getProgramArgumentsArray()); runConfig.setEnvironment(envp); runConfig.setVMArguments(execArgs.getVMArgumentsArray()); runConfig.setWorkingDirectory(workingDirName); runConfig.setVMSpecificAttributesMap(vmAttributesMap); if (supportsModule()) { String modName = module == null ? null : module.getElementName(); if (modName != null) { runConfig.setModuleDescription(modName); runConfig.setBootClassPath(getBootpath(configuration)); } else if (supportsModule()) { runConfig.setModulepath(paths[1]); if (!configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_DEFAULT_MODULE_CLI_OPTIONS, true)) { runConfig.setOverrideDependencies(configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_MODULE_CLI_OPTIONS, "")); //$NON-NLS-1$ } else { runConfig.setOverrideDependencies(getModuleCLIOptions(configuration));
ArrayList<String> vmArguments= new ArrayList<>(); vmArguments.addAll(Arrays.asList(runConfig.getVMArguments())); vmArguments.addAll(Arrays.asList(DebugPlugin.parseArguments(getVMArguments(configuration, mode)))); vmArguments.addAll(Arrays.asList(execArgs.getVMArgumentsArray())); runConfig.setVMArguments(vmArguments.toArray(new String[vmArguments.size()])); runConfig.setWorkingDirectory(workingDirName); runConfig.setEnvironment(getEnvironment(configuration)); runConfig.setVMSpecificAttributesMap(vmAttributesMap); runConfig.setBootClassPath(getBootpath(configuration)); } else { runConfig.setModulepath(paths[1]); if (!configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_DEFAULT_MODULE_CLI_OPTIONS, true)) { runConfig.setOverrideDependencies(configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_MODULE_CLI_OPTIONS, "")); //$NON-NLS-1$ } else { runConfig.setOverrideDependencies(getModuleCLIOptions(configuration));
VMRunnerConfiguration vmConfig = new VMRunnerConfiguration( getMainTypeName(configuration), classPath); vmConfig.setProgramArguments(argv.toArray(new String[argv.size()])); vmConfig.setVMArguments(vmArguments.toArray(new String[vmArguments.size()]));
String[] mp = config.getModulepath(); if (mp != null && mp.length > 0) { // There can be scenarios like junit where launched class is in classpath arguments.add(convertClassPath(mp)); String[] cp = config.getClassPath(); if (cp.length > 0) { arguments.add("-classpath"); //$NON-NLS-1$ String dependencies = config.getOverrideDependencies(); if (dependencies != null && dependencies.length() > 0) { String[] parseArguments = DebugPlugin.parseArguments(dependencies); arguments.add(config.getModuleDescription() + "/" + config.getClassToLaunch()); //$NON-NLS-1$ } else { arguments.add(config.getClassToLaunch()); String[] programArgs= config.getProgramArguments(); addArguments(programArgs, arguments); String[] envp = prependJREPath(config.getEnvironment());
if (file != null && file.exists()) { IVMRunner vmRunner = getVMInstall().getVMRunner(ILaunchManager.RUN_MODE); VMRunnerConfiguration config = new VMRunnerConfiguration("org.eclipse.jst.server.tomcat.core.internal.ClassDetector", new String[] { file.getAbsolutePath() }); config.setProgramArguments(new String[] { "com.sun.tools.javac.Main" }); ILaunch launch = new Launch(null, ILaunchManager.RUN_MODE, null); try {
@Override public IStatus run(IProgressMonitor monitor) { monitor.subTask(MessageFormat.format(Messages.EmbeddedVMRunner_0, launch.getLaunchConfiguration().getName())); final DynamicURLClassLoader classLoader = DynamicURLClassLoader.newInstance( ClassLoader.getSystemClassLoader(), classPathURLs); try { ClassLoaderFinder.setPreferredClassLoader(classLoader); final String mainClass = configuration.getClassToLaunch(); final Class<?> clazz = classLoader.loadClass(mainClass); final Method mainMethod = clazz.getDeclaredMethod("main", String[].class); //$NON-NLS-1$ mainMethod.invoke(null, (Object) configuration.getProgramArguments()); return SARLEclipsePlugin.getDefault().createOkStatus(); } catch (Throwable exception) { return SARLEclipsePlugin.getDefault().createStatus(IStatus.ERROR, exception); } finally { ClassLoaderFinder.popPreferredClassLoader(); monitor.done(); } } };
throws CoreException { try { final String[] classpath = configuration.getClassPath(); final URL[] classPathURLs = new URL[classpath.length]; Arrays.parallelSetAll(classPathURLs, index -> {
runConfig= new VMRunnerConfiguration(mainTypeName, classpath); runConfig.setVMArguments(vmArguments.toArray(new String[vmArguments.size()])); runConfig.setProgramArguments(programArguments.toArray(new String[programArguments.size()])); runConfig.setEnvironment(envp); runConfig.setWorkingDirectory(workingDirName); runConfig.setVMSpecificAttributesMap(vmAttributesMap); runConfig.setBootClassPath(getBootpath(configuration)); } else { runConfig.setModulepath(modulepath); if (!configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_DEFAULT_MODULE_CLI_OPTIONS, true)) { runConfig.setOverrideDependencies(configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_MODULE_CLI_OPTIONS, "")); //$NON-NLS-1$ } else { runConfig.setOverrideDependencies(getModuleCLIOptions(configuration));
VMRunnerConfiguration config = new VMRunnerConfiguration("org.eclipse.jdt.internal.launching.support.LegacySystemProperties", new String[] { file.getAbsolutePath() });//$NON-NLS-1$ IVMRunner runner = getVMRunner(ILaunchManager.RUN_MODE); if (runner == null) { config.setVMArguments(new String[] { StandardVMType.MIN_VM_SIZE }); config.setProgramArguments(properties); Launch launch = new Launch(null, ILaunchManager.RUN_MODE, null); if (monitor.isCanceled()) {
addBootClassPathArguments(arguments, config); String[] mp = config.getModulepath(); if (mp != null && mp.length > 0) { // There can be scenarios like junit where launched class is in classpath String[] cp= config.getClassPath(); if (cp.length > 0) { arguments.add("-classpath"); //$NON-NLS-1$ String dependencies = config.getOverrideDependencies(); if (dependencies != null && dependencies.length() > 0) { String[] parseArguments = DebugPlugin.parseArguments(dependencies); arguments.add(config.getModuleDescription() + "/" + config.getClassToLaunch()); //$NON-NLS-1$ } else { arguments.add(config.getClassToLaunch()); addArguments(config.getProgramArguments(), arguments); String[] envp = prependJREPath(config.getEnvironment(), new Path(program));
/** * Creates a new debug target for the given virtual machine and system process * that is connected on the specified port for the given launch. * * @param config run configuration used to launch the VM * @param launch launch to add the target to * @param port port the VM is connected to * @param process associated system process * @param vm JDI virtual machine * @return the {@link IDebugTarget} */ protected IDebugTarget createDebugTarget(VMRunnerConfiguration config, ILaunch launch, int port, IProcess process, VirtualMachine vm) { return JDIDebugModel.newDebugTarget(launch, vm, renderDebugTarget(config.getClassToLaunch(), port), process, true, false, config.isResumeOnStartup()); }
VMRunnerConfiguration runnerConfig = new VMRunnerConfiguration(getMainClass(), getClasspath(configuration)); runnerConfig.setVMArguments(getVMArguments(configuration)); runnerConfig.setProgramArguments(getProgramArguments(configuration)); runnerConfig.setWorkingDirectory(getWorkingDirectory(configuration).getAbsolutePath()); runnerConfig.setEnvironment(getEnvironment(configuration)); runnerConfig.setVMSpecificAttributesMap(getVMSpecificAttributesMap(configuration));
VMRunnerConfiguration config = new VMRunnerConfiguration("org.eclipse.jdt.internal.launching.support.LegacySystemProperties", new String[] { file.getAbsolutePath() });//$NON-NLS-1$ IVMRunner runner = getVMRunner(ILaunchManager.RUN_MODE); if (runner == null) { config.setVMArguments(new String[] { StandardVMType.MIN_VM_SIZE }); config.setProgramArguments(properties); Launch launch = new Launch(null, ILaunchManager.RUN_MODE, null); if (monitor.isCanceled()) {
String[] cp= config.getClassPath(); int cpidx = -1; if (cp.length > 0) { arguments.add(convertClassPath(cp)); arguments.add(config.getClassToLaunch()); String[] programArgs= config.getProgramArguments(); addArguments(programArgs, arguments); String[] envp = prependJREPath(config.getEnvironment());
VMRunnerConfiguration runConfig = new VMRunnerConfiguration( mainTypeName, classpath); runConfig.setProgramArguments(executionArguments .getProgramArgumentsArray()); runConfig.setEnvironment(environment); runConfig.setVMArguments(executionArguments.getVMArgumentsArray()); runConfig.setWorkingDirectory(workingDirName); runConfig.setVMSpecificAttributesMap(vmAttributesMap); runConfig.setBootClassPath(bootpath);
addArguments(vmArgs, arguments); String[] bootCP= config.getBootClassPath(); String[] classPath = config.getClassPath(); arguments.add(convertClassPath(combinedPath)); arguments.add(config.getClassToLaunch()); String[] programArgs= config.getProgramArguments(); String[] envp = prependJREPath(config.getEnvironment()); String[] newenvp = checkClasspath(arguments, classPath, envp); if(newenvp != null) {