aspose file tools*
The moose likes Java in General and the fly likes opening a PDF file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "opening a PDF file" Watch "opening a PDF file" New topic
Author

opening a PDF file

miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
i dont know why this code doesnt give an error but also doesnt open the pdf file
can anyone please help me?
(the file is in the right path)


java amateur
Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

A must-read about Runtime.exec: here.


"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18651
    
    8

You might consider this method:

which has made that Windows hack obsolete.
miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
Paul Clapham wrote:You might consider this method:

which has made that Windows hack obsolete.


thank you, Paul

but now i've another problem: if my path has spaces in it, it wont work:
Errorjava.lang.IllegalArgumentException: The file: C:\Documents and Settings\...\C.pdf doesn't exist.

is there any workaround for this situation?
chaitanya karthikk
Ranch Hand

Joined: Sep 15, 2009
Posts: 806

Hi miguel, I had the same problem while writing a program in C++, there I used
c:\\progra~1\\java\\jre6\\lib\\ext\\jxl.jar
.
I don't know how far it will work in Java.
I wrote that program to copy my Java files to respective directories as a part of installing my application on the clients system.

Love all, trust a few, do wrong to none.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10451
    
    8

Put the file name inside double quotes to work around the space problem


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: opening a PDF file