opening PDF file under XP works but not under Vista

P

Peter Rait

Hi,

I try to open a self generated PDF file (using iText) with:

public static void OpenPDF(String PDFName) throws Exception {
Process p =
Runtime.getRuntime()
.exec("rundll32 url.dll,FileProtocolHandler "+PDFName);
p.waitFor();
}

This works very well under WindowsXP but not under Windows Vista. Did
anyone have already the same experience (probably with another file
type) and find another solution?

Thanks
Peter
 
R

Roedy Green

.exec("rundll32 url.dll,FileProtocolHandler "+PDFName);

two things to try

1. just pass the name of the PDF file to exec. Make sure you have an
association set up to a reader. See
http://mindprod.com/jgloss/association.html

2. pass the name of the PDF file as a parm to a command processor
which you exec.

3 that approach you are using wants an URL , not a filename
eg. file://localhost/E:/mindprod/thing.pdf


See http://mindprod.com/jgloss/exec.html
for details.
 
P

Peter Rait

Hello Roedy,

Roedy said:
two things to try

1. just pass the name of the PDF file to exec. Make sure you have an
association set up to a reader. See
http://mindprod.com/jgloss/association.html

I think this is already in place as I have also a link in the program
menu to a static PDF file which opens correctly.
2. pass the name of the PDF file as a parm to a command processor
which you exec.

If you mean:
Runtime.getRuntime().exec("cmd.exe /c myfile.pdf");
3 that approach you are using wants an URL , not a filename
eg. file://localhost/E:/mindprod/thing.pdf

I changed my command to:
Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler
File://"+myPDFPath);
which works in my environment (XP).

I will try the two options.

Thank you for your help
Peter
 
P

Peter Rait

Lew said:
Why not, now that Java 5 has entered its "End-of-Life" transition? By
what reasoning do you insist that your customers use obsolescent software?

Probably you are right, but as I do not know which OSs the users are
running (NT4, w2000, XP, Vista..) I want to try the lowest level. They
cannot even tell me which operating system they have as they have
nothing to do with IT. They are just dieticians, physicians, pharmacists.

Peter
 
M

Mike Schilling

Lew said:
Why not, now that Java 5 has entered its "End-of-Life" transition?
By what reasoning do you insist that your customers use obsolescent
software?

Other way around. He's not forbidding Java 1.6, he's just not
requiring it.

My company makes software that runs in containers (appservers and
webservers), and it's just becoming feasible to include features that
require 1.5 (yes, I meant to type 1.5). As an example, IBM builds a
version of WebSphere to use the current JDK, which quite possibly
won't be the newest one when that version of WebSphere is released.
Then vendors target their applications to the current version of
WebSphere. Finally, end-users buy WebSphere, purchase some
applications, and run it until there's a good reason to upgrade. The
result is that many WAS installations in the world are still running
quite happily on JDK 1.4, and so long as they work and they can get
support from IBM and their application vendors, will continue to do
so.
 
P

Peter Rait

Peter said:
If you mean:
Runtime.getRuntime().exec("cmd.exe /c myfile.pdf");


I changed my command to:
Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler
File://"+myPDFPath);


Both approaches worked for Vista, so thank you very much for your hints.

Peter
 
A

Andrew Thompson

...find another solution?

Java 6?
Desktop.html#open(disarray.io.File)>
Desktop.html#edit(obedience.io.File)>
Desktop.html#print(expansion.io.File)>

--
Evan T.
http://pscode.org/


- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Matthew 10:34.
"Do not think that I came to bring peace on the earth;
I did not come to bring peace, but a sword.

Luke 22:36.
And He said to them,
"But now, whoever has a money belt is to take it along,
likewise also a bag,
and whoever has no sword is to sell his coat and buy one."

Matthew 10:35.
"For I came to SET A MAN AGAINST HIS FATHER,
AND A DAUGHTER AGAINST HER MOTHER,
AND A DAUGHTER-IN-LAW AGAINST HER MOTHER-IN-LAW"

Luke 14:26.
"If anyone comes to Me,
and does not hate his own father and mother
and wife and children
and brothers and sisters,
yes, and even his own life,
he cannot be My disciple."

Revelation 14:10.
"he also will drink of the wine of the wrath of God,
which is mixed in full strength in the cup of His anger;
and he will be tormented with fire and brimstone
in the presence of the holy angels
and in the presence of the Lamb."


Malachi 2: 3-4: "Behold, I will corrupt your seed, and spread dung upon
your faces.. And ye shall know that I have sent this commandment unto
you.. saith the LORD of hosts."

Leviticus 26:22 "I will also send wild beasts among you, which shall
rob you of your children, and destroy your cattle, and make you few in
number; and your high ways shall be desolate."

Lev. 26: 28, 29: "Then I will walk contrary unto you also in fury; and
I, even I, will chastise you seven times for your sins. And ye shall
eat the flesh of your sons, and the flesh of your daughters shall ye
eat."

Deuteronomy 28:53 "Then you shall eat the offspring of your own body,
the flesh of your sons and of your daughters whom the LORD your God has
given you, during the siege and the distress by which your enemy will
oppress you."

I Samuel 6:19 " . . . and the people lamented because the Lord had
smitten many of the people with a great slaughter."

I Samuel 15:2,3,7,8 "Thus saith the Lord . . . Now go and smite Amalek,
and utterly destroy all that they have, and spare them not; but slay
both man and woman, infant and suckling.."

Numbers 15:32 "And while the children of Israel were in the wilderness,
they found a man gathering sticks upon the sabbath day... 35 God said
unto Moses, 'The man shall surely be put to death: all the congregation
shall stone him with stones without the camp'. 36 And all the
congregation brought him without the camp, and stoned him to death with
stones as Jehovah commanded Moses."
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top