How do I launch the default (native) application for a given file from Java?

I am displaying a list of files; Xls, Doc, PDF, ODT, etc. in my java application (eclipse RCP) When the user clicks the file, I want to start the corresponding native application (according to the operating system), just like in Windows Explorer or finder

When I'm here: it's best to show the same icon finder or explorer for different file types

Is there a library or Eclipse Plug-in?

Solution

What you want is Java awt. Desktop:

Desktop.getDesktop().open( file );
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>