Openeing PDF file
Hi,
Using stand alone program i want to open .pdf file when user clicks on a help menu.
i have done this using Runtime.exec(" acrobatpath.exe test.pdf"); where acrobatpath.exe is the location
of acrobat exe file location and test.pdf is the file to be opened.
But i will be installing this stand alone application in each machine. But i dont know the path of exe
exactly. how can i achieve this. i wanted it to open in acrobat exe automatically by finding it in windows
system. If it is not installed in the present system, i want a message popup saying "open with..." dialog.
how can i achieve this. This is a stand alone application developed using swings.
your help is appreciable.
Thanks in advance.
take care,
Rizwan.
[797 byte] By [
rizzu] at [2007-9-30 21:53:52]

Use
Runtime.exec(" explorer TEST.PDF_ABSOLUTE_PATH\test.pdf");
but this will restrict your application to Windows Platform wich will be a bad idea, another way is to use API for Processing PDFs like the one in http://www.pdfbox.org , Have Fun
Regards,
Mohammed Saleem
Hi,
U can use Runtime.exec("<PATH OF ACROBAT> file.pdf") or use alternative method which is find the location of acrobat.exe in ur System directories using Java.io.File in recursive manner. It will help u
modify the below example to ur need
public void process(File b) throws IOException {
try {
if (b.isDirectory()) {
String [] subs = b.list();
if (subs != null && subs.length > 0) {
for(int i = 0; i < subs.length; i++) {
File f2 = new File(subs);
// place to check ur file name is Acrobat.exe .then proceed and retuen the path
process(new File(b,subs));
}
System.out.println(b.getCanonicalPath());
String parentPath = b.getParentFile().getCanonicalPath();
}
}
}
catch (IOException ie) {
System.out.println("Exception on path: " + ie);
}
}
regards
sivajik