-1

I have the below property code in my java class

certificateDerFile = System.getProperty("catalina.base")
                + "//logs//Cert_patch.der";

Now my query is that in the path "//logs//Cert_patch.der", it should be refactored such // slashes should not be there should be some file separator which should work both in windows and Linux, please advise how to achieve the same.

plr108
  • 1,201
  • 11
  • 16

1 Answers1

1
File.separator is either / or \ that is used to split up the path to a spec
ific file. For example on Windows it is \ or C:\Documents\Test

For example:

String path = File.separator + "var"+ File.separator + "temp"

Linux: /var/temp

Windows: \var\temp

fanky10
  • 1,112
  • 1
  • 14
  • 14