There are several ways to do this, and none of them are truly ideal. The first (and easiest) is to require that Adobe Acrobat Reader be in the system path for the machines on which you are installing. This is the easiest method, but requires some amount of clout with the people setting up the systems on which your program will run.
Short of that, you could create a .properties file and have the path to Acrobat be specified therein. If Acrobat is located in different places on different machines, then each machine needs to have its own .properties file. This can get annoying because you might have to individually configure the .properties file on every machine that this program is deployed on.
Thirdly, you could use the java.io.File class to explore the computer until you found the acrobat reader executable. Not ideal processwise, but this is truly dynamic. You just have to know what drive letters the computer has (and while these can change, you can
test them by creating a file for J:\ and asking if the file exists.) Once you've found it once, you could store the location in a .properties file so you wouldn't have to search again. (Or, if someone knows a better way of searching a computer for a file???)
Finally, can we assume that you don't want to open Reader by itself but would rather open a document in reader? You can create a temporary .bat file that contains the name of the file you want to open. Then call Runtime.getRuntime().exec(<BATCH_FILE_NAME>
; If the extension is properly mapped, the OS should automatically launch Reader and display that file. Note that you can't just use the name of the file as the parameter to exec(
String) because the VM expects a process to start. (I tried this and it does not work.) It should be able to run batch files, however.