Check if the given String points to a Python installation in Java

31 Views Asked by At

Is there any way I can check in Java if the String I'm receiving points to a valid Python installation directory?

The idea is to force the user to only give a valid path to his Python installation folder, and if the path is not valid, return an error to let them know.

1

There are 1 best solutions below

0
Lennart Steinke On

This solution has a couple of problems. On *nix machines, there is not really such a thing as a installation directory.

So, instead of a directory, you might want the use to select an executable. This will also allow you to run a python --version to check if the version is ok.