java.lang.IllegalArgumentException: Malformed \uxxxx encoding.

1.报错信息

java.lang.IllegalArgumentException: Malformed \uxxxx encoding.
    at java.util.Properties.loadConvert(Unknown Source)
    at java.util.Properties.load0(Unknown Source)
    at java.util.Properties.load(Unknown Source)
    at pers.hanchao.InitConfig.init(Unknown Source)

2.报错分析

报错产生于Properties.load(new FileInputStream(xmlPath))时,xmlPath路径中含有\u,例如:
C:\Users\Administrator\test\env.properties.

3.解决方法

两种方法

3.1.修改配置文件存放路径

3.2.将路径中的/替换成//

xmlPath = xmlPath.replace("/","//");

你可能感兴趣的:(Exception,Java杂七杂八)