“Java Run Comando Shell” Respostas de código

Java Run Comando Shell

String homeDirectory = System.getProperty("user.home");
Process process;
if (isWindows) {
    process = Runtime.getRuntime()
      .exec(String.format("cmd.exe /c dir %s", homeDirectory));
} else {
    process = Runtime.getRuntime()
      .exec(String.format("sh -c ls %s", homeDirectory));
}
StreamGobbler streamGobbler = 
  new StreamGobbler(process.getInputStream(), System.out::println);
Executors.newSingleThreadExecutor().submit(streamGobbler);
int exitCode = process.waitFor();
assert exitCode == 0;
Horrible Hyena

Como executar um arquivo java no terminal

javac FirstJavaProgram.java
uncommon_student

Respostas semelhantes a “Java Run Comando Shell”

Perguntas semelhantes a “Java Run Comando Shell”

Mais respostas relacionadas para “Java Run Comando Shell” em Java

Procure respostas de código populares por idioma

Procurar outros idiomas de código