Viewing a file using default application associated with it
Rahul Agarwal
Ranch Hand
Joined: Sep 13, 2000
Posts: 52
posted
0
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
posted
0
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