0

I'm trying to get this folder

File imagesOrg = new File(getClass().getResource("/stock").getPath());

I've printed it out in console with

 System.out.println(imagesOrg.getAbsolutePath());

and there is a space within my path so it was changed to %20 and because of that the rest of my code doesn't work which is:

 for(final File child : imagesOrg.listFiles()) {
                    System.out.println(child.getName());
 }

If I put the whole path in new File with a space instead of %20 it works fine is there an easy solution to this?

Higeath
  • 541
  • 5
  • 20

1 Answers1

0

I recommand URL decoder.

You can use like this..

String result = java.net.URLDecoder.decode(url, "UTF-8");

Gary Y Kim
  • 79
  • 4