Question about: new URLDecoder().decode( Class.getResource().getFile() )

Discussion in 'Java' started by opalpa@gmail.com, Dec 21, 2004.

  1. Guest

    I got an executable file that is a resource of a java class. This
    executable gets run using Runtime.getRuntime().exec which needs a
    String path

    To get my String path for exec I first get the URL of the executable
    using getResource() . URL has a getFile method which returns a String.
    This String is not the right one for exec because it is URL encoded
    with sequences like %20 and %25.

    Not much trouble, just use URLDecoder to get at the String.

    Here is the question:
    Does getResource() return a URL in a particular encoding?
    Alternatively I can see getResource() return a platform specific
    encoding in which case I want URLDecoder.decode(String) which is
    deprecated because it uses platform specifc encodings.

    Cheers
     
    , Dec 21, 2004
    #1
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Manish Hatwalne

    getResource()

    Manish Hatwalne, Feb 9, 2004, in forum: Java
    Replies:
    7
    Views:
    6,224
    Andrew Thompson
    Feb 10, 2004
  2. HK
    Replies:
    4
    Views:
    1,208
  3. Replies:
    6
    Views:
    1,408
    John C. Bollinger
    Feb 22, 2005
  4. E11
    Replies:
    1
    Views:
    5,666
    Thomas Weidenfeller
    Oct 12, 2005
  5. kempshall

    Class.getResource path resolution

    kempshall, Jan 3, 2006, in forum: Java
    Replies:
    2
    Views:
    26,222
    Chris Smith
    Jan 4, 2006
  6. elventear

    Problem with inspect.getfile

    elventear, May 1, 2007, in forum: Python
    Replies:
    4
    Views:
    479
    Gabriel Genellina
    May 6, 2007
  7. Ryan
    Replies:
    3
    Views:
    2,182
    Jean-Baptiste Nizet
    Oct 18, 2007
  8. fniles
    Replies:
    15
    Views:
    1,308
    Bob Barrows
    May 8, 2009
Loading...