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

O

opalpa

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top