File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes opening a PDF file Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply 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: 16483
    
    2

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: 779

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: 8439

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


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

Joined: Feb 08, 2004
Posts: 1281
thanks
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: opening a PDF file
 
Similar Threads
how to change existing pdf font encoding (multi language) dynamically
Open a PDF fie inside a jar
Passing binary files in webservices
JSp Output to PDF
How to initiate a file download or push to client?