Results 1 to 4 of 4
  1. #1
    Mertuhh is offline Member
    Join Date
    Mar 2011
    Rep Power

    Default getting file url using windows open with

    Hello guys,

    I've been busy with java for a while and I really love it.
    To keep it short and simple:

    I'm trying to create a program that will open images from out windows.
    It's a bit hard to explain but let's say I have a gif image.
    I'd like to open the image WITH my application.
    The problem is, it's not like windows photo viewer.
    Is there a way to get the file url by starting the application using open with?

  2. #2
    dlorde is offline Senior Member
    Join Date
    Jun 2008
    Rep Power


    Quote Originally Posted by Mertuhh View Post
    Is there a way to get the file url by starting the application using open with?
    I don't understand what you're asking. Can you restate what you're trying to achieve, in plain English? For example, what would the user of your application see when they start it running, and what would they have to do?

  3. #3
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Rep Power


    I think that's the point.
    The user will select an image on (say) a windows desktop and can open that image using his Java app (right-click and "Open With...").

    Which I'm fairly sure is not doable. Unless there's some way of associating "java -jar <jar file>" to it.

  4. #4
    couling is offline Member
    Join Date
    Nov 2010
    Rep Power


    Hi Mertuhh

    Getting the File URL is simple. Windows will pass it in as a command line arguement into the args[] of your main method.

    Getting windows to display your program and kick it off will require changes to your windows registery. That can't be done through Java (I believe) because the registery isnt really a cross platform concept.

    It looks like one or two things have changed since I last looked at this part of the registry so I'll figure it out and get back to you with the settings.


    Edit: Yes Tolls, you should be able to register a "java .... " with a file type, either to be the default handling program or just be in the open with menu.
    Last edited by couling; 03-09-2011 at 06:02 PM.
    ----Signature ----
    Please use [CODE] tags and indent correctly. It really helps when reading your code.

Similar Threads

  1. Passing array arguments into main
    By JohnDas in forum New To Java
    Replies: 12
    Last Post: 11-10-2010, 04:00 PM
  2. Replies: 8
    Last Post: 09-23-2010, 12:07 AM
  3. Replies: 5
    Last Post: 10-06-2008, 12:11 AM
  4. Arguments in Main
    By CyberFrog in forum New To Java
    Replies: 2
    Last Post: 03-30-2008, 09:37 PM
  5. Replies: 1
    Last Post: 08-06-2007, 09:11 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts