I am in a refactoring stage for a project I am working on and would like to make some improvements to how I build and represent file system paths. What things should I take into consideration when representing relative paths in Java code to ensure compatibility on Ubuntu, OSX, and Windows 7.
Currently to get an instance of File referencing "MyProject/foo/bar.f" I would have code along the lines of:
File bar = new File(ProjectDirectory + "/" + FooResourceDirectory + "/" + barName);
This seems wrong for several reasons, what are some of the best practices?