I have a Java program that runs on Linux, and from within the program, I want to open files (e.g. PDF files) with the system's native viewer. There are various programs available for this purpose: gnome-open, gvfs-open, xdg-open, ... Which one(s) should I use to cover as many Linux distributions as possible?


xdg-open is the safest bet. Not everyone will necessarily have gnome or gvfs installed. xdg-open, on the other hand, is not tied to any desktop environment or toolkit.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.