Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > opening PDF file under XP works but not under Vista

Reply
Thread Tools

opening PDF file under XP works but not under Vista

 
 
Peter Rait
Guest
Posts: n/a
 
      06-14-2008
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
 
Reply With Quote
 
 
 
 
Andrew Thompson
Guest
Posts: n/a
 
      06-15-2008
On Jun 15, 9:03*am, Peter Rait <r...@gmx.at> wrote:

> ...find another solution?


Java 6?
<http://java.sun.com/javase/6/docs/api/java/awt/
Desktop.html#open(java.io.File)>
<http://java.sun.com/javase/6/docs/api/java/awt/
Desktop.html#edit(java.io.File)>
<http://java.sun.com/javase/6/docs/api/java/awt/
Desktop.html#print(java.io.File)>

--
Andrew T.
http://pscode.org/
 
Reply With Quote
 
 
 
 
Roedy Green
Guest
Posts: n/a
 
      06-15-2008
On Sun, 15 Jun 2008 01:03:46 +0200, Peter Rait <> wrote,
quoted or indirectly quoted someone who said :

> .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.
--

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
 
Reply With Quote
 
Roedy Green
Guest
Posts: n/a
 
      06-15-2008
On Sun, 15 Jun 2008 01:03:46 +0200, Peter Rait <> wrote,
quoted or indirectly quoted someone who said :

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


For yet another approach see http://mindprod.com/jgloss/desktop.html

--

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
 
Reply With Quote
 
Peter Rait
Guest
Posts: n/a
 
      06-15-2008
Hello Roedy,

Roedy Green schrieb:
> On Sun, 15 Jun 2008 01:03:46 +0200, Peter Rait <> wrote,
> quoted or indirectly quoted someone who said :
>
>> .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


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
 
Reply With Quote
 
Peter Rait
Guest
Posts: n/a
 
      06-15-2008
Andrew Thompson schrieb:
> On Jun 15, 9:03 am, Peter Rait <r...@gmx.at> wrote:
>
>> ...find another solution?

>
> Java 6?
> <http://java.sun.com/javase/6/docs/api/java/awt/
> Desktop.html#open(java.io.File)>


Thanks, but I do not want to require Java 6 installed on the PCs of the
users getting my application. I will give the suggestions of Roedy Green
a try.

Peter
 
Reply With Quote
 
Peter Rait
Guest
Posts: n/a
 
      06-15-2008
Lew schrieb:
> Peter Rait wrote:
>> Thanks, but I do not want to require Java 6 installed on the PCs of
>> the users getting my application.

>
> 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
 
Reply With Quote
 
Mike Schilling
Guest
Posts: n/a
 
      06-16-2008
Lew wrote:
> Peter Rait wrote:
>> Thanks, but I do not want to require Java 6 installed on the PCs of
>> the users getting my application.

>
> 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.


 
Reply With Quote
 
Peter Rait
Guest
Posts: n/a
 
      06-16-2008
Peter Rait schrieb:
> If you mean:
> Runtime.getRuntime().exec("cmd.exe /c myfile.pdf");
>
>> 3 that approach you are using wants an URL , not a filename

>
> 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
 
Reply With Quote
 
Andrew Thompson
Guest
Posts: n/a
 
      06-29-2008
On Jun 15, 9:03=A0am, Norm Rait <r...@gmx.at> wrote:

> ...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."

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
PDF::Writer, create pdf and insert in other pdf file. Ricardo Pog Ruby 1 03-26-2008 08:24 PM
Cisco VPN Client Vista RC2 - works under Beta2 but has install error in RC2 Martin NZ Computing 1 10-15-2006 10:43 PM
Word file not opening from Adm -My recent docs but opening from file menu of Word Thaqalain Computer Support 0 06-30-2005 02:20 AM
[py2exe.i18n] English works, German works, but not French. What do I miss? F. GEIGER Python 3 08-06-2004 10:01 AM
Security warning msg when opening PDF file under Https:// =?Utf-8?B?TWFyaw==?= ASP .Net 1 04-13-2004 08:24 PM



Advertisments