本文整理匯總了Java中org.springframework.boot.loader.tools.JavaExecutable類的典型用法代碼示例。如果您正苦於以下問題:Java JavaExecutable類的具體用法?Java JavaExecutable怎麽用?Java JavaExecutable使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
JavaExecutable類屬於org.springframework.boot.loader.tools包,在下文中一共展示了JavaExecutable類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: runJar
import org.springframework.boot.loader.tools.JavaExecutable; //導入依賴的package包/類
@Test
public void runJar() throws Exception {
File target = new File("target");
File[] jarFiles = target.listFiles(new FileFilter() {
@Override
public boolean accept(File file) {
return file.getName().endsWith(".jar");
}
});
assertThat(jarFiles).hasSize(1);
Process process = new JavaExecutable().processBuilder("-jar", jarFiles[0].getName()).directory(target).start();
process.waitFor(5, TimeUnit.MINUTES);
assertThat(process.exitValue()).isEqualTo(0);
String output = FileCopyUtils.copyToString(new InputStreamReader(process.getInputStream()));
assertThat(output).contains("Spring Boot Ant Example");
}
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:19,代碼來源:SampleAntApplicationIT.java
示例2: runWithForkedJvm
import org.springframework.boot.loader.tools.JavaExecutable; //導入依賴的package包/類
@Override
protected void runWithForkedJvm(List<String> args) throws MojoExecutionException {
try {
RunProcess runProcess = new RunProcess(new JavaExecutable().toString());
Runtime.getRuntime()
.addShutdownHook(new Thread(new RunProcessKiller(runProcess)));
int exitCode = runProcess.run(true, args.toArray(new String[args.size()]));
if (exitCode != 0) {
throw new MojoExecutionException(
"Application finished with non-zero exit code: " + exitCode);
}
}
catch (Exception ex) {
throw new MojoExecutionException("Could not exec java", ex);
}
}
示例3: runJar
import org.springframework.boot.loader.tools.JavaExecutable; //導入依賴的package包/類
@Test
public void runJar() throws Exception {
File target = new File("target");
File[] jarFiles = target.listFiles(new FileFilter() {
@Override
public boolean accept(File file) {
return file.getName().endsWith(".jar");
}
});
assertThat("Number of jars", jarFiles.length, equalTo(1));
Process process = new JavaExecutable().processBuilder("-jar", jarFiles[0].getName()).directory(target).start();
process.waitFor(5, TimeUnit.MINUTES);
assertThat(process.exitValue(), equalTo(0));
String output = FileCopyUtils.copyToString(new InputStreamReader(process.getInputStream()));
assertThat(output, containsString("Spring Boot Ant Example"));
}
示例4: runWithForkedJvm
import org.springframework.boot.loader.tools.JavaExecutable; //導入依賴的package包/類
@Override
protected void runWithForkedJvm(List<String> args) throws MojoExecutionException {
try {
RunProcess runProcess = new RunProcess(new JavaExecutable().toString());
Runtime.getRuntime()
.addShutdownHook(new Thread(new RunProcessKiller(runProcess)));
runProcess.run(true, args.toArray(new String[args.size()]));
}
catch (Exception ex) {
throw new MojoExecutionException("Could not exec java", ex);
}
}
示例5: runWithForkedJvm
import org.springframework.boot.loader.tools.JavaExecutable; //導入依賴的package包/類
@Override
protected void runWithForkedJvm(List<String> args) throws MojoExecutionException {
try {
new RunProcess(new JavaExecutable().toString()).run(true,
args.toArray(new String[args.size()]));
}
catch (Exception ex) {
throw new MojoExecutionException("Could not exec java", ex);
}
}
示例6: ForkProcessCommand
import org.springframework.boot.loader.tools.JavaExecutable; //導入依賴的package包/類
ForkProcessCommand(Command command) {
super(new JavaExecutable().toString());
this.command = command;
}
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:5,代碼來源:ForkProcessCommand.java