java - Special characters ("\") in .properties-file -


i'm developing java application executes on windows. have several backslashes ("\") in .properties-file. file looks like:

dir=\\127.0.0.1\d$\dir\dir2\dir3 

i read property dir using spring annotation value:

@value("${dir}") protected string dir; 

this results in string 127.0.0.1d$dirdir2dir3 when property dir used in code.

i have tried unicode escapes this:

dir=\u005c\u005c127.0.0.1\u005cd$\u005cdir\u005cdir2\u005cdir3 

i have tried backslash escape this:

dir=\\\\127.0.0.1\\d$\\dir\\dir2\\dir3 

both of tries above results in string \\127.0.0.1d$dirdir2dir3 when property dir used in code.

i want property dir set \\127.0.0.1\d$\dir\dir2\dir3 when property used in code. shall .properties-file result?

you can use forward slashes, beyond reason works on windows


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -