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?
pathSeparator: Platform dependent variable for path-separator. For example PATH or CLASSPATH variable list of paths separated by ':' in Unix systems and ';' in Windows system. File. pathSeparatorChar: Same as pathSeparator but it's char.
The path separator is a character commonly used by the operating system to separate individual paths in a list of paths.
A file separator is a character that is used to separate directory names that make up a path to a particular location. This character is operating system specific.
1) Simple and easy way If Java or Javac is not in your path then you can add them into path by adding "bin" directory or your JDK installation directory into environment variable "PATH". Both windows and UNIX use same name.
Just use /
. I've been using it for 23.5 years. Never a problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With