Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

opening a PDF file

 
miguel lisboa
Ranch Hand
Posts: 1281
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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)
 
Wouter Oet
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A must-read about Runtime.exec: here.
 
Paul Clapham
Sheriff
Posts: 21892
36
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might consider this method:

which has made that Windows hack obsolete.
 
miguel lisboa
Ranch Hand
Posts: 1281
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 806
Java MySQL Database Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Put the file name inside double quotes to work around the space problem
 
miguel lisboa
Ranch Hand
Posts: 1281
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks
 
Everybody's invited. Even this tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!