win-exec


Лицензия

Лицензия

Группа

Группа

io.webfolder
Идентификатор

Идентификатор

win-exec
Последняя версия

Последняя версия

1.0.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

win-exec
win-exec
Ссылка на сайт

Ссылка на сайт

https://github.com/webfolderio/win-exec
Система контроля версий

Система контроля версий

https://github.com/webfolderio/win-exec.git

Скачать win-exec

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/io.webfolder/win-exec/ -->
<dependency>
    <groupId>io.webfolder</groupId>
    <artifactId>win-exec</artifactId>
    <version>1.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/io.webfolder/win-exec/
implementation 'io.webfolder:win-exec:1.0.0'
// https://jarcasting.com/artifacts/io.webfolder/win-exec/
implementation ("io.webfolder:win-exec:1.0.0")
'io.webfolder:win-exec:jar:1.0.0'
<dependency org="io.webfolder" name="win-exec" rev="1.0.0">
  <artifact name="win-exec" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.webfolder', module='win-exec', version='1.0.0')
)
libraryDependencies += "io.webfolder" % "win-exec" % "1.0.0"
[io.webfolder/win-exec "1.0.0"]

Зависимости

test (4)

Идентификатор библиотеки Тип Версия
org.zeroturnaround : zt-zip jar 1.13
org.zeroturnaround : zt-exec jar 1.11
org.slf4j : slf4j-simple jar 1.7.30
commons-io : commons-io jar 2.6

Модули Проекта

Данный проект не имеет модулей.

wf-exec

Process executor for Java which use Win32 Job Objects on Windows platform. Unlike default process executor this library help you to kill child process when parent dies normally or abnormally (reaps all zombie/defunct process).

AppVeyor License

Supported Java Versions

Oracle & OpenJDK Java 8, 11.

Both the JRE and the JDK are suitable for use with this library.

How it is tested

wf-exec is regularly tested on appveyor (Windows)

Integration with Maven

The project artifacts are available in Maven Central Repository.

To use the official release of wf-exec, please use the following snippet in your pom.xml file.

Add the following to your POM's <dependencies> tag:

<dependency>
    <groupId>io.webfolder</groupId>
    <artifactId>wf-exec</artifactId>
    <version>1.0.4</version>
</dependency>

Download

wf-exec-1.0.4.jar - 163 KB

Example

public class Example {

  private static final boolean WINDOWS  = getProperty("os.name")
                                              .toLowerCase(ENGLISH)
                                              .startsWith("windows");

  public static void main(String[] args) throws IOException {
    // load jni library
    WindowsJniLoader.loadJni();
    
    SubprocessFactory factory = WINDOWS ? WindowsSubprocessFactory.INSTANCE :
                                          JavaSubprocessFactory.INSTANCE;

    SubprocessBuilder builder = new SubprocessBuilder(factory);

    builder.setWorkingDirectory(new File("."));

    builder.setArgv("java.exe", "-version");

    StringBuilder buffer = new StringBuilder();

    Subprocess process = builder.start();
    try (Scanner scanner = new Scanner(process.getErrorStream())) {
      while (scanner.hasNext()) {
        String line = scanner.nextLine().trim();
        if (line.isEmpty()) {
          continue;
        }
        buffer.append(line).append("\r\n");
      }
    }

    // terminate the process
    process.destroy();

    while (process.finished()) {
      // wait until process finished
    }

    // close the native resources
    process.close();

    System.out.println(buffer.toString());
  }
}

License

Licensed under the Apache License.

Note: The included code from bazel is licensed under Apache.

Версии библиотеки

Версия
1.0.0