In File class, there is a variable defined which will give the path seperator of the system. Use it directly while building the path in Java for a file or folder path. static String pathSeparator:The system-dependent path-separator character, represented as a string for convenience.
static char pathSeparatorChar:The system-dependent path-separator character.
static String separator:The system-dependent default name-separator character, represented as a string for convenience.
static char separatorChar:The system-dependent default name-separator character.
ex: public static final String PATH = "c:" + File.pathSeperator + "NewFolder";