0

I'm having a problem with path-setting in my java code. I am using this code snippet to set the path in the code i'm working on.

System.getProperty("user.dir") + "/src/main/resources/folder/testFile.txt" 

But when I print this on console it the output is like this;

E:\Eclipse-K2\northbay-train/src/main/resources/folder/testFile.txt

My code of the util method gives the error in the path setting line which courses a failure. Can some one give me tip to get over with the problem?

Indi
  • 421
  • 9
  • 28
  • 1
    This is a duplicate of https://stackoverflow.com/questions/2417485/difference-between-file-separator-and-slash-in-paths – DCTID Jan 01 '20 at 15:47

1 Answers1

-1

try this

String path = System.getProperty("user.dir")+"\\src\\main\\resources\\folder\\testFile.txt";

hope it will work for you

Sarjit
  • 799
  • 7
  • 9
  • 1
    This answer doesn't deal with the complexities of the file separator or have any explanation why a double slash is helpful. – DCTID Jan 01 '20 at 15:49