Java, check if an executable exists in PATH environment

environment-variables, java

Solution

You can use `Runtime.getRuntime().exec("command");` in `try ... catch` section. If app won't be in `PATH` you will get an exception.

[EDIT]

But .. this will execute app instead of check. Sorry.

Problem

I can print the path using `System.getenv("PATH")`. Then I probably can traverse those paths and use `File` to check if the file is exist. Is there any faster way in Java ?

Original source

Related problems