How to open user system "select program to open with" for given file?

Discussion in 'Java' started by asarturas, Feb 11, 2009.

  1. asarturas

    asarturas New Member

    Feb 11, 2009
    Likes Received:
    Trophy Points:

    I'm trying to make file management application in Java.

    I already know how to open file in system preferred application. It's quite easy.

    The other issue I thinking about now is that I need to implement "Open With" functionality (like in Ubuntu: you right press on the file -> select "Open With" -> "Other" and system's default application selection window starts.

    I tried to manage that with some Java default classes, but I didn't found one.

    So, I'm working on solution, based on Runtime.getRuntime().exec("something");

    I already know what commands i should write in Mac and Windows to open "application selection" for file:
    1) Windows: RUNDLL32.EXE SHELL32.DLL,OpenAs_RunDLL <file.ext>
    2) Mac: open <file.ext>

    How to do same on linux (Gnome/KDE)? I still not found easy solution for that.

    Or maybe I am digging in wrong direction? If so - prease correct me.

    P.S. I tried Desktop.getDesktop() and Java Desktop Integration Components (JDIC), but it seems, that both of them don't have a function for functionality i need.

    Thank you for your replies.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice