本文整理汇总了Java中org.apache.tools.ant.util.JavaEnvUtils.getJdkExecutable方法的典型用法代码示例。如果您正苦于以下问题:Java JavaEnvUtils.getJdkExecutable方法的具体用法?Java JavaEnvUtils.getJdkExecutable怎么用?Java JavaEnvUtils.getJdkExecutable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.tools.ant.util.JavaEnvUtils
的用法示例。
在下文中一共展示了JavaEnvUtils.getJdkExecutable方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: compile
import org.apache.tools.ant.util.JavaEnvUtils; //导入方法依赖的package包/类
/**
* Performs the actual compilation.
* @param javah the calling javah task.
* @return true if the compilation was successful.
* @throws BuildException if there is an error.
*/
@Override
public boolean compile(Javah javah) throws BuildException {
Commandline cmd = SunJavah.setupJavahCommand(javah);
Project project = javah.getProject();
String executable = JavaEnvUtils.getJdkExecutable("javah");
javah.log("Running " + executable, Project.MSG_VERBOSE);
cmd.setExecutable(executable);
//set up the args
String[] args = cmd.getCommandline();
try {
Execute exe = new Execute(new LogStreamHandler(javah,
Project.MSG_INFO,
Project.MSG_WARN));
exe.setAntRun(project);
exe.setWorkingDirectory(project.getBaseDir());
exe.setCommandline(args);
exe.execute();
return !exe.isFailure();
} catch (IOException exception) {
throw new BuildException("Error running " + executable
+ " -maybe it is not on the path", exception);
}
}
示例2: execute
import org.apache.tools.ant.util.JavaEnvUtils; //导入方法依赖的package包/类
/**
* exec by creating a new command
* @return true if the command ran successfully
* @throws BuildException on error
*/
@Override
public boolean execute() throws BuildException {
Rmic owner = getRmic();
Commandline cmd = setupRmicCommand();
Project project = owner.getProject();
String executable = owner.getExecutable();
if (executable == null) {
// no explicitly specified executable
// rely on RMIC being on the path
executable = JavaEnvUtils.getJdkExecutable(getExecutableName());
}
cmd.setExecutable(executable);
//set up the args
String[] args = cmd.getCommandline();
try {
Execute exe = new Execute(new LogStreamHandler(owner,
Project.MSG_INFO,
Project.MSG_WARN));
exe.setAntRun(project);
exe.setWorkingDirectory(project.getBaseDir());
exe.setCommandline(args);
exe.execute();
return !exe.isFailure();
} catch (IOException exception) {
throw new BuildException("Error running " + getExecutableName()
+ " -maybe it is not on the path", exception);
}
}
示例3: getSystemJavac
import org.apache.tools.ant.util.JavaEnvUtils; //导入方法依赖的package包/类
/**
* @return the executable name of the java compiler
*/
protected String getSystemJavac() {
return JavaEnvUtils.getJdkExecutable("javac");
}