My application and browser are windows. Now if I move application over to linux platform how can I achieve the same thing? Pardon me, seeking expert advise in advance (I didn't try it yet).My user will always be opening IE from windows.
You oughtn't to use Runtime.exec() on its own; you get two Streams representing standard error and standard output, both of which must be "emptied" otherwise your Runtime.exec() might throw an exception. Google for "when Runtime.exec() won't" (sic) and you will get an article by Dacosta from 2000 about this very problem. Look in the API at the ProcessBuilder class, which I am not familiar with, but may provide a simpler solution to that problem.
You don't usually use Acrobat on Linux, but evince. I tried this on a Bash shell
[Campbell@dhcppc0 ~]$ which evince /usr/bin/evince [Campbell@dhcppc0 ~]$ evince /home/Campbell/oldFolders/Eiffel/ECMA-367.pdf
. . . and a few seconds later ECMA-367 opened. So try and see what happens. Or tryYou will have various Streams to "empty" and various Exceptions to catch, but you should find the details in the API for Process and ProcessBuilder and in Dacosta.
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32830
4
posted
0
Sorry, but the Streams you want to get from the Process can be obtained with the getErrorStream() and getInputStream() methods.
Actually, since Acrobat Reader isn't supposed to be using any of the standard I/O files, having the process fail on a write to stdout/stderr is OK by me. I've had to fix problems where processes exec'ed and had stream I/O to contend with, but never had issues when they were mute. And setting up to handle streams that shouldn't exist is a lot of trouble.
I do tend to prefer Acrobat Reader over evince or XPDF myself. On my home system, I think it's in /usr/local/Acrobat/bin/acroread, but the machine I'm using right now just has it in /usr/bin/acroread.
Customer surveys are for companies who didn't pay proper attention to begin with.
Have you considered embedding a PDF viewer into your Java code so that it is far more portable? For example Accessing a PDF Document with the Acrobat Viewer JavaBean. This is only one example - there are plenty of other portable solutions as well.
Well, the Acrobat Java Viewer Bean hasn't been updated for ages (at least since PDF 1.4 came along, and maybe before that), and has serious problems displaying PDFs using recent features. So it works for simple stuff, but nothing fancy.