3

I am using Spring Framework version 4.3.18.RELEASE under Intellij on Windows 7. I am looking at the decompiled code of, for example, the class

org.springframework.core.io.DefaultResourceLoader

and the method

public Resource getResource(String location).

In that code it has a test for

location.startsWith("/")

This fails when the location is an absolute Windows path with a leading drive letter. E.g.

d:/git/thredds/dap4/d4tests/src/test/resources/

Is there a known alternate specification of such a path that will work?

2 Answers2

1

try something like

 getResource("file:d:\\git\thredds\blah.txt") 

in case the file is stored along your classes

getResource("classpath:com/my/package/testing.txt");
Frederic Close
  • 9,389
  • 6
  • 56
  • 67
0

Did you try with double slash and reverse slash? Like

C:\\Users\\...

or

C:\Users\...
Alpcan Yıldız
  • 671
  • 3
  • 13
  • 33