我在 RAD 中收到以下错误:
java.net.URISyntaxException: Illegal character in path at index 16: file:/E:/Program Files/IBM/SDP/runtimes/base......
能否请您告诉我错误是什么以及如何解决?
最佳答案
索引 16 处有一个非法字符。我会说它不喜欢路径中的空格。您可以percent encode空格等特殊字符。在这种情况下,将其替换为 %20。
我上面链接的问题建议使用 URLEncoder :
String thePath = "file://E:/Program Files/IBM/SDP/runtimes/base";
thePath = URLEncoder.encode(thePath, "UTF-8");
关于java - 索引 16 处路径中的非法字符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4992317/