/** * Executes the given classname with the given arguments as it * were a command line application. * @param command CommandlineJava. */ private void run(CommandlineJava command) throws BuildException { try { ExecuteJava exe = new ExecuteJava(); exe.setJavaCommand(command.getJavaCommand()); exe.setClasspath(command.getClasspath()); exe.setSystemProperties(command.getSystemProperties()); exe.setPermissions(perm); exe.setTimeout(timeout); redirector.createStreams(); exe.execute(getProject()); redirector.complete(); if (exe.killedProcess()) { throw new BuildException(TIMEOUT_MESSAGE); } } catch (IOException e) { throw new BuildException(e); } }
public boolean compile(Javah javah) throws BuildException { Commandline cmd = setupJavahCommand(javah); ExecuteJava ej = new ExecuteJava(); Class<?> c; try { ej.setJavaCommand(cmd); File f = Locator.getClassSource(c); if (f != null) { ej.setClasspath(new Path(javah.getProject(), f.getPath())); return ej.fork(javah) == 0;
/** * 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 executable. * @param command command to execute. */ private void setupCommandLineForVMS(Execute exe, String[] command) { ExecuteJava.setupCommandLineForVMS(exe, command); }
/** {@inheritDoc} */ @Override protected boolean run(Commandline cmd, ProjectComponent log) throws BuildException { ExecuteJava ej = new ExecuteJava(); Class<?> c = getN2aClass(); if (c == null) { throw new BuildException( "Couldn't load Kaffe's Native2Ascii class"); } cmd.setExecutable(c.getName()); ej.setJavaCommand(cmd); ej.execute(log.getProject()); // otherwise ExecuteJava has thrown an exception return true; }
/** * Run the compilation. * @return true if the compilation succeeded * @exception BuildException if the compilation has problems. */ @Override public boolean execute() throws BuildException { attributes.log("Using kjc compiler", Project.MSG_VERBOSE); Commandline cmd = setupKjcCommand(); cmd.setExecutable("at.dms.kjc.Main"); ExecuteJava ej = new ExecuteJava(); ej.setJavaCommand(cmd); return ej.fork(getJavac()) == 0; }
run(); //NOSONAR } else { thread = new Thread(this, "ExecuteJava");
/** {@inheritDoc} */ @Override public boolean execute() throws BuildException { getRmic().log("Using Kaffe rmic", Project.MSG_VERBOSE); Commandline cmd = setupRmicCommand(); Class<?> c = getRmicClass(); if (c == null) { StringBuilder buf = new StringBuilder( "Cannot use Kaffe rmic, as it is not available. None of "); for (String className : RMIC_CLASSNAMES) { if (buf.length() > 0) { buf.append(", "); } buf.append(className); } buf.append( " have been found. A common solution is to set the environment variable JAVA_HOME or CLASSPATH."); throw new BuildException(buf.toString(), getRmic().getLocation()); } cmd.setExecutable(c.getName()); if (!c.getName().equals(RMIC_CLASSNAMES[RMIC_CLASSNAMES.length - 1])) { //NOSONAR // only supported since Kaffe 1.1.2 cmd.createArgument().setValue("-verbose"); getRmic().log(Commandline.describeCommand(cmd)); } ExecuteJava ej = new ExecuteJava(); ej.setJavaCommand(cmd); return ej.fork(getRmic()) == 0; }
log("Command invoked: " + command.getJavaCommand().toString()); ExecuteJava execute = new ExecuteJava(); execute.setClasspath(path); execute.setJavaCommand(command.getJavaCommand()); if (execute.fork(this) != 0) throw new BuildException("Could not invoke WSProvideTask", getLocation());
exe.setAntRun(pc.getProject()); if (Os.isFamily("openvms")) { setupCommandLineForVMS(exe, cmdl.getCommandline()); } else { exe.setCommandline(cmdl.getCommandline());
log("Command invoked: " + command.getJavaCommand().toString()); ExecuteJava execute = new ExecuteJava(); execute.setClasspath(path); execute.setJavaCommand(command.getJavaCommand()); if (execute.fork(this) != 0) throw new BuildException("Could not invoke WSConsumeTask", getLocation());
ExecuteJava.setupCommandLineForVMS(exe, cl); } else { exe.setCommandline(cl);