aspose file tools
The moose likes Swing / AWT / SWT and the fly likes Viewing a file using default application associated with it Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply Bookmark "Viewing a file using default application associated with it" Watch "Viewing a file using default application associated with it" New topic
Author

Viewing a file using default application associated with it

Rahul Agarwal
Ranch Hand

Joined: Sep 13, 2000
Posts: 52
I have to make an application in which a box appears and from where I can select a file which will open in default application associated with it.
Like .pdf files should open in Acrobat Reader and .htm in explorer and .doc in Word.
Can somebody help?
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
In Windows, when the user tries to open a file, Windows searches the registry for a known file extention. If it finds one, it reads the registry entry to find out which application is to be used for that type of file. Then it opens the file using that app. If no matching entry can be found in the registry you will get the little dialog box telling you that the file type is unknown. It asks you to pick an application to use for opening this file. To duplicate this functionality in Java, you will have to use JNI to access the system registry.
 
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: Viewing a file using default application associated with it
 
Similar Threads
Using Helper Applications
Rundll related issue
W3K question
Custom debugger in eclipse
open acrobat reader in swing component