Java Desktop opens files with different extensions

77 views Asked by At

I am using Desktop class to open files like .txt files, .pdf files, images, etc; I have a problem that when I open first file, lets say a .jpg file, the images are displayed in the image viewer, then I try to open a .pdf document, the Desktop object tries to open the .pdf file with the image viewer, and it fails.

When I open the .pdf file first, it opens correctly. After that when I try to open a .jpg file, it is opened in the pdf browser. And so it fails...

In short, the first program associated with the first file, is used to open all the other files. how can I solve it ?

0

There are 0 answers