I am launching some external applications from java Runtime.exec(). It works fine when everything goes well(i.e the application path is correct, file to launch is ok. etc...) but I wonder is there any way to determine if the application is installed before I launch, since I believe Runtime.exec() does not provide much control after it is called. I just need to know how I can determine if the application exists(installed) before I launch from java . It doesn't have to be using java Runtime but any method would be fine. here is my general scenerio
1. 1 of 2 applications to lunch
2. I can assume that the user will have at least one of them installed
3. depending on what is installed, I willl launch using it
4. if both of them are installed, I will give the user to select one of them.
Thanks in advance
I assume that the applications are files located somewhere on the OS's path (the PATH environ var in windows, I don't know about other OS). If you can get the value of PATH, then you could look on all the paths for the file that starts the application.
You can use the file methods