How to check if python is installed in windows from java?

13,600

Solution 1

Use the Java Runtime to exec the following command "python --version".

If it works, you have Python, and the standard output is the version number.

If it doesn't work, you don't have Python.

Solution 2

Most Python installers add keys to the Windows registry. Here's an article about how to add that information, you can use it to see how to read the information.

Solution 3

Have you tried querying the registry to check if it is installed? It is stored in

software\python\pythoncore

If the user has a (relatively) new version of python, that is installed with the MSI-package, you can use the MsiEnumProducts Function to check if python is installed.

Share:
13,600
Goutham
Author by

Goutham

Updated on June 30, 2022

Comments

  • Goutham
    Goutham almost 2 years

    How can I check from inside a java program if python is installed in windows? Python does not add its path to the system Path and no assumption is to be made about the probable path of installation(i.e it can be installed anywhere).