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
Getting windows native information using java SDK is not possible without support of external APIs. Instead of using external APIs (which is mostly LGPL licensed and not completely open), we can use the shell commands to get the same.
Step 1 - Checking if (perl) an application is installed
For checking if an application is installed, use ProcessBuilder or Runtime.exec to run one of the following PowerShell command,
Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall* | Select-Object DisplayName | where {$_.DisplayName -match "perl"}
Replace "perl" with your choice of software and stream the output of these and process it.
If PERL (for above question), follow below 2 steps to set path and run perl script from java
Step 2 - If available, set it to Environment Path using java code.
Step 3 - Run your perl script.