This period of time in the use of SPRINGMVC image upload operation, but upload the picture path due to cross-platform (Windows path delimiter is "\", Linux for "/") conversion needs to be defined, trouble! Accidentally found in the java.io. The file class in the package contains some of the symbols we normally use, so that we don't have to customize them, saving time and effort and worry.
For example: A path cross-platform is best written like this:
Automatic access to the current system's delimiter style
File MyFile = new file ("C:" + file.separator + "tmp" + file.separator, "test.txt");
The file class has several static fields similar to separator, which are system-related and should be used as much as possible when programming.
The other:
Separatorchar
public static final Char Separatorchar
The system-related default name delimiter. This field is initialized to the first character that contains the system attribute File.separator value. On a UNIX system, the value of this field is '/'; on a Microsoft Windows system, it is ' \ '.
Separator
public static final String separator
The system-related default name delimiter, which is represented as a string for convenience. This string contains only one character, that is, Separatorchar.
Pathseparatorchar
public static final Char Pathseparatorchar
The system-related path delimiter. This field is initially the first character that contains the system attribute Path.separator value. This character is used to separate the file names in a sequence of files given as a list of paths. On a UNIX system, this field is ': '; on a Microsoft Windows system, it is '; '.
PathSeparator
public static final String PathSeparator
The system-related path delimiter, for convenience, is represented as a string. This string contains only one character, that is, Pathseparatorchar.
Hope to be useful to everyone!
Java. Io. System-related static fields in file such as: "/"