Wrote a Web project that was properly tested locally, but there was an error deploying to the server. The reason is that the configuration file is not read.
Later from the printed file path is found in the Java Class.getResource ("/"). GetPath () When you get the path, the spaces in the path are converted to%20.
On the Internet to find relevant information, sure enough to turn the space into%20 is an old bug, I specifically take this record, I hope to help meet the same problems of friends.
Bug id:4466485 getclass (). GetResource (). GetFile () returns file name with%20
This bug was introduced in June 2001 and eventually closed in November 2002.
There is no fix because doing so can cause compatibility issues.
Here's a solution:
Configpath = Java.net.URLDecoder.decode (Configpath,"Utf-8");
"Java" about classes in Java. class.getresource ("/"). GetPath () Gets the problem with a space in the path