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. Advertising

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. HK
    Replies:
    4
    Views:
    993
  2. Replies:
    6
    Views:
    1,131
    John C. Bollinger
    Feb 22, 2005
  3. kempshall

    Class.getResource path resolution

    kempshall, Jan 3, 2006, in forum: Java
    Replies:
    2
    Views:
    25,925
    Chris Smith
    Jan 4, 2006
  4. elventear

    Problem with inspect.getfile

    elventear, May 1, 2007, in forum: Python
    Replies:
    4
    Views:
    332
    Gabriel Genellina
    May 6, 2007
  5. fniles
    Replies:
    15
    Views:
    1,074
    Bob Barrows
    May 8, 2009
Loading...

Share This Page