Path delimiter in windows and linux for java code

Viewed 16804

In my java code, I have some hard coded paths which I have written as

String workingPath = initPath + "\\" + tmpPath;

the initPath and tmpPath are obtained by File.getParent(). Now, that works on windows and if I move my code to linux, the \\ will be problematic since the other two are determined by system methods. The results is something like this

/home/mahmood/project/alpha\temp1

How can I fix that? I don't want to put / in my code for linux systems.

2 Answers
Related