/** * On VMS platform, we need to create a special java options file * containing the arguments and classpath for the java command. * The special file is supported by the "-V" switch on the VMS JVM. * * @param exe the Execute instance to alter. * @param command the command-line. */ public static void setupCommandLineForVMS(Execute exe, String[] command) { //Use the VM launcher instead of shell launcher on VMS exe.setVMLauncher(true); File vmsJavaOptionFile = null; try { String[] args = new String[command.length - 1]; System.arraycopy(command, 1, args, 0, command.length - 1); vmsJavaOptionFile = JavaEnvUtils.createVmsJavaOptionFile(args); //we mark the file to be deleted on exit. //the alternative would be to cache the filename and delete //after execution finished, which is much better for long-lived runtimes //though spawning complicates things... vmsJavaOptionFile.deleteOnExit(); String[] vmsCmd = {command[0], "-V", vmsJavaOptionFile.getPath()}; exe.setCommandline(vmsCmd); } catch (IOException e) { throw new BuildException("Failed to create a temporary file for \"-V\" switch"); } }
exe.setVMLauncher(true);
/** * Execute the created command line. * * @param cmd The command line to run. * @return int the exit code. * @throws BuildException if something goes wrong */ protected int run(Commandline cmd) { try { Execute exe = new Execute(new LogStreamHandler(this, Project.MSG_INFO, Project.MSG_WARN)); exe.setAntRun(getProject()); exe.setWorkingDirectory(getProject().getBaseDir()); exe.setCommandline(cmd.getCommandline()); exe.setVMLauncher(false); // Use the OS VM launcher so we get environment variables return exe.execute(); } catch (java.io.IOException e) { throw new BuildException(e, getLocation()); } }
exe.setCommandline(cmd.getCommandline()); exe.setVMLauncher(false); return exe.execute(); } catch (IOException e) {
/** * Create an Execute instance with the correct working directory set. * * @return an instance of the Execute class. * * @throws BuildException under unknown circumstances. */ protected Execute prepareExec() throws BuildException { // default directory to the project's base directory if (dir == null) { dir = getProject().getBaseDir(); } if (redirectorElement != null) { redirectorElement.configure(redirector); } Execute exe = new Execute(createHandler(), createWatchdog()); exe.setAntRun(getProject()); exe.setWorkingDirectory(dir); exe.setVMLauncher(vmLauncher); String[] environment = env.getVariables(); if (environment != null) { for (String variable : environment) { log("Setting environment variable: " + variable, Project.MSG_VERBOSE); } } exe.setNewenvironment(newEnvironment); exe.setEnvironment(environment); return exe; }
exe.setVMLauncher(false); exe.setCommandline(cmdline); exe.execute();
exe.setVMLauncher(false); exe.setCommandline(cmdline); exe.execute();
exec.setVMLauncher(true); exec.setCommandline(commands); final int i = exec.execute();
exec.setVMLauncher(true); exec.setCommandline(commands); final int i = exec.execute();
exec.setVMLauncher(true); exec.setCommandline(commands); final int i = exec.execute();
execute.setVMLauncher(true); execute.setWorkingDirectory(cwd.toFile()); execute.setStreamHandler(streamHandler);
execute.setVMLauncher(true); execute.setWorkingDirectory(cwd.toFile()); execute.setStreamHandler(streamHandler);
Execute exec = new Execute(); exec.setAntRun(getProject()); exec.setVMLauncher(true); exec.setCommandline(Commandline.translateCommandline(commandLine)); if (classPath != null && isClassFileAvailable()) exec.setStreamHandler(new RunTask.StackTraceTranslatorHandler(getProject().getBaseDir(), classPath.list())); exec = new Execute(); exec.setAntRun(getProject()); exec.setVMLauncher(true); exec.setCommandline(Commandline.translateCommandline(listCommandLine)); exec.setStreamHandler(new RunTask.ListStreamHandler()); exec = new Execute(); exec.setAntRun(getProject()); exec.setVMLauncher(true); exec.setCommandline(Commandline.translateCommandline(otaRunCommandLine)); if (classPath != null && isClassFileAvailable()) exec.setStreamHandler(new RunTask.StackTraceTranslatorHandler(getProject().getBaseDir(), classPath.list()));
Execute exec = new Execute(); exec.setAntRun(getProject()); exec.setVMLauncher(true); exec.setCommandline(Commandline.translateCommandline(commandLine)); if (classPath != null && isClassFileAvailable()) exec.setStreamHandler(new RunTask.StackTraceTranslatorHandler(getProject().getBaseDir(), classPath.list())); exec = new Execute(); exec.setAntRun(getProject()); exec.setVMLauncher(true); exec.setCommandline(Commandline.translateCommandline(listCommandLine)); exec.setStreamHandler(new RunTask.ListStreamHandler()); exec = new Execute(); exec.setAntRun(getProject()); exec.setVMLauncher(true); exec.setCommandline(Commandline.translateCommandline(otaRunCommandLine)); if (classPath != null && isClassFileAvailable()) exec.setStreamHandler(new RunTask.StackTraceTranslatorHandler(getProject().getBaseDir(), classPath.list()));