Platform independent paths in Java

jakewins picture jakewins · Aug 23, 2010 · Viewed 95.9k times · Source

I know the relative path of a file and want to handle it as a File object on both Linux and Windows.

What is the best way to specify platform-independent paths in Java?

Answer

user207421 picture user207421 · Aug 24, 2010

Just use /. I've been using it for 23.5 years. Never a problem.