/** * 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); } }
"Cannot spawn a java process in non-forked mode. Please set fork='true'. "); if (getCommandLine().getClasspath() != null && getCommandLine().getJar() != null) { log("When using 'jar' attribute classpath-settings are ignored. See the manual for more information.",
private ClassLoader createClassloader() { List<URL> classLoaderUrls = new ArrayList<URL>(); for (String classPathEntry : getCommandLine().getClasspath().list()) { try { classLoaderUrls.add(new File(classPathEntry).toURL()); } catch (MalformedURLException malformedURLException) { log("Exception while create classloader for generator.", malformedURLException, Project.MSG_ERR); } } URL[] urls = classLoaderUrls.toArray(new URL[classLoaderUrls.size()]); return new URLClassLoader(urls, getClass().getClassLoader()); }
private void initTCCL() { try { List<URL> classPathUrls = new ArrayList<URL>(Collections.singletonList(getClassDir().toURI().toURL())); Path classpath = getCommandLine().getClasspath(); @SuppressWarnings("unchecked") Iterator<FileResource> iterator = classpath.iterator(); while (iterator.hasNext()) { FileResource next = iterator.next(); classPathUrls.add(next.getFile().toURI().toURL()); } Thread.currentThread().setContextClassLoader( URLClassLoader.newInstance(classPathUrls.toArray(new URL[] {}), getClass().getClassLoader())); } catch (Exception e) { throw new BuildException(e.getMessage(), e); } }
/** * {@inheritDoc} */ @Override public String getClasspath() { Path p = this.java.getCommandLine().getClasspath(); return (p != null) ? p.toString() : ""; }
if (getCommandLine().getClasspath() != null) { copyPathTo(getCommandLine().getClasspath(), remotedir.getAbsolutePath() + "/classpath");
resetPathToUnderPrefixIfExistsAndIsFileIfNotExistsAddAsIs(commandLine.getClasspath(), "classpath", commandBuilder);
final Path userClasspath = getCommandline().getClasspath(); final Path userModulepath = getCommandline().getModulepath(); if (userClasspath != null || userModulepath != null) {
private void createArgs() { validateArgs(); createArg().setValue("-d"); createArg().setValue(getDestdir().getAbsolutePath()); if (getTempdir() != null) { createArg().setValue("-tp"); createArg().setValue(getTempdir().getAbsolutePath()); } if (getCommandLine().getClasspath() != null) { createArg().setValue("-cp"); createArg().setValue(getCommandLine().getClasspath().toString()); } if (getEncoding() != null) { createArg().setValue("-encoding"); createArg().setValue(getEncoding()); } }
final Path path = new Path(getProject()); path.add(antRuntimeClasses); Path extra = getCommandline().getClasspath(); if (extra != null) { path.add(extra);
this.getClass().getClassLoader(), getProject(), getCommandline().getClasspath(), true);
for (String classPathEntry : getCommandLine().getClasspath().list()) { reader.addPath(new File(classPathEntry).getPath());
createArg().setValue("--source-classpath"); createArg().setValue(sourceClasspath.toString()); } else if (getCommandLine().getClasspath() != null) { createArg().setValue("--source-classpath"); createArg().setValue(getCommandLine().getClasspath().toString()); createArg().setValue("--template-classpath"); createArg().setValue(templateClasspath.toString()); } else if (getCommandLine().getClasspath() != null) { createArg().setValue("--template-classpath"); createArg().setValue(getCommandLine().getClasspath().toString());
this.getClass().getClassLoader(), getProject(), getCommandline().getClasspath(), true);