当前位置: 首页>>代码示例>>Java>>正文


Java JavaExecutable类代码示例

本文整理汇总了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);
	}
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:18,代码来源:RunMojo.java

示例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"));
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:19,代码来源:SampleAntApplicationIT.java

示例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);
	}
}
 
开发者ID:philwebb,项目名称:spring-boot-concourse,代码行数:13,代码来源:RunMojo.java

示例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);
	}
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:11,代码来源:RunMojo.java

示例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


注:本文中的org.springframework.boot.loader.tools.JavaExecutable类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。