Detect if certain software is installed on a user's machine in Java

后端 未结 4 1290
时光说笑
时光说笑 2020-12-20 00:53

I have a Java application which requires certain software (one of them being Perl) before it can be run. What I used to do to detect for Perl is:

Runtime.get         


        
4条回答
  •  情话喂你
    2020-12-20 01:32

    If the user is not willing to either

    • Install perl in an agreed upon location
    • Indicate where perl has been installed by storing it's location in an environment variable, config file, windows registry, etc.

    then it seems you're only option is to search the entire disk for an executable named 'Perl'. Obviously this could take a very long time, but if you store the location somewhere, at least you should only need to search for it once

提交回复
热议问题