/** * Set the location of the JAR file to execute. * * @param jarfile the jarfile to execute. * * @throws BuildException if there is also a {@code classname}, {@code module} * or {@code sourcefile} attribute specified */ public void setJar(File jarfile) throws BuildException { if (getCommandLine().getClassname() != null || getCommandLine().getModule() != null || getCommandLine().getSourceFile() != null) { throw new BuildException( "Cannot use combination of 'jar', 'sourcefile', 'classname', 'module' attributes in same command"); } getCommandLine().setJar(jarfile.getAbsolutePath()); }
/** * Set the Java source-file to execute. Support for single file source program * execution, in Java, is only available since Java 11. * * @param sourceFile The path to the source file * @throws BuildException if there is also a {@code jar}, {@code classname} * or {@code module} attribute specified * @since Ant 1.10.5 */ public void setSourceFile(final String sourceFile) throws BuildException { final String jar = getCommandLine().getJar(); final String className = getCommandLine().getClassname(); final String module = getCommandLine().getModule(); if (jar != null || className != null || module != null) { throw new BuildException("Cannot use 'sourcefile' in combination with 'jar' or " + "'module' or 'classname'"); } getCommandLine().setSourceFile(sourceFile); }
String classname = getCommandLine().getClassname(); String module = getCommandLine().getModule(); final String sourceFile = getCommandLine().getSourceFile(); log("running " + this.getCommandLine().getClassname() + " with default permissions (exit forbidden)", Project.MSG_VERBOSE);
commandBuilder.append(" ").append(commandLine.getClassname());