org.apache.tools.ant.taskdefs.Execute.setVMLauncher()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(6.0k)|赞(0)|评价(0)|浏览(141)

本文整理了Java中org.apache.tools.ant.taskdefs.Execute.setVMLauncher()方法的一些代码示例,展示了Execute.setVMLauncher()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Execute.setVMLauncher()方法的具体详情如下:
包路径:org.apache.tools.ant.taskdefs.Execute
类名称:Execute
方法名:setVMLauncher

Execute.setVMLauncher介绍

[英]Launch this execution through the VM, where possible, rather than through the OS's shell. In some cases and operating systems using the shell will allow the shell to perform additional processing such as associating an executable with a script, etc.
[中]在可能的情况下,通过VM而不是通过操作系统的外壳启动此执行。在某些情况下,使用shell的操作系统将允许shell执行附加处理,例如将可执行文件与脚本关联等。

代码示例

代码示例来源:origin: org.apache.ant/ant

/**
 * 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");
  }
}

代码示例来源:origin: org.apache.ant/ant

exe.setVMLauncher(true);

代码示例来源:origin: org.apache.ant/ant

/**
 * 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());
  }
}

代码示例来源:origin: org.apache.ant/ant

exe.setCommandline(cmd.getCommandline());
  exe.setVMLauncher(false);
  return exe.execute();
} catch (IOException e) {

代码示例来源:origin: org.apache.ant/ant

/**
 * 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;
}

代码示例来源:origin: de.tudarmstadt.ukp.dkpro.lab/dkpro-lab-core

exe.setVMLauncher(false);
exe.setCommandline(cmdline);
exe.execute();

代码示例来源:origin: de.tudarmstadt.ukp.dkpro.lab/de.tudarmstadt.ukp.dkpro.lab.core

exe.setVMLauncher(false);
exe.setCommandline(cmdline);
exe.execute();

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-j2me-common-ant

exec.setVMLauncher(true);
exec.setCommandline(commands);
final int i = exec.execute();

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-mobility-antext

exec.setVMLauncher(true);
exec.setCommandline(commands);
final int i = exec.execute();

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-mobility-antext

exec.setVMLauncher(true);
exec.setCommandline(commands);
final int i = exec.execute();

代码示例来源:origin: randomizedtesting/randomizedtesting

execute.setVMLauncher(true);
execute.setWorkingDirectory(cwd.toFile());
execute.setStreamHandler(streamHandler);

代码示例来源:origin: com.carrotsearch.randomizedtesting/junit4-ant

execute.setVMLauncher(true);
execute.setWorkingDirectory(cwd.toFile());
execute.setStreamHandler(streamHandler);

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-j2me-common-ant

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()));

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-mobility-antext

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()));

相关文章