我在RAD中得到以下错误:
java.net.URISyntaxException: Illegal character in path at index 16: file:/E:/Program Files/IBM/SDP/runtimes/base......
你能告诉我错误是什么以及如何解决吗?
我在RAD中得到以下错误:
java.net.URISyntaxException: Illegal character in path at index 16: file:/E:/Program Files/IBM/SDP/runtimes/base......
你能告诉我错误是什么以及如何解决吗?
索引16处有一个非法字符。我想说它不喜欢小路上的空隙。您可以percentencode特殊字符,如空格。在这种情况下,请将其替换为%20。
我链接到上面的问题建议使用URL编码器:
String thePath = "file://E:/Program Files/IBM/SDP/runtimes/base";
thePath = URLEncoder.encode(thePath, "UTF-8");
我在Bing地图API上也遇到了同样的问题。URLEncoder只是让事情变得更糟,但replaceAll(“”,“%20”)
成功了。
你试过这个吗?
new File("<PATH OF YOUR FILE>").toURI().toString();
空间也有同样的问题。URL和URI的结合解决了这个问题:
URL url = new URL("file:/E:/Program Files/IBM/SDP/runtimes/base");
URI uri = new URI(url.getProtocol(), url.getUserInfo(), url.getHost(), url.getPort(), url.getPath(), url.getQuery(), url.getRef());
我在xml中遇到了类似的问题。只是传递错误和解决方案(编辑Jonathon版本)。
代码:
HttpGet xmlGet = new HttpGet( xmlContent );
Xml格式:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<employee>
<code>CA</code>
<name>Cath</name>
<salary>300</salary>
</employee>
错误:
java.lang.IllegalArgumentException: Illegal character in path at index 0: <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<contents>
<portalarea>CA</portalarea>
<portalsubarea>Cath</portalsubarea>
<direction>Navigator</direction>
</contents>
at java.net.URI.create(URI.java:859)
at org.apache.http.client.methods.HttpGet.<init>(HttpGet.java:69)
at de.vogella.jersey.first.Hello.validate(Hello.java:56)
不完全完美的解决方案:(该实例的错误消失)
String theXml = URLEncoder.encode( xmlContent, "UTF-8" );
HttpGet xmlGet = new HttpGet( theXml );
知道我应该做什么吗它刚刚通过,但在执行此操作时出现问题
HttpResponse response = httpclient.execute( xmlGet );
the install directory can t have space. reinstall the software will correct it
如果jdk出现此错误,请使用以下方法:
progra~1而不是路径示例中的程序文件:
c:/progra~1/java instead of c:/program files/java
总是避免java代码中的空格是可以的。。。。。
它可以用于程序文件中的每一件事,否则在开头和路径的en处加引号
“抄送:/…./”
Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...
Check this, List<String> list = new ArrayList<String>(); for (int i = 0; i < 10000; i++) { String value = (""+UUID.randomUUID().getLeastSignificantBits()).substring(3, ...
I am in the middle of solving a problem where I think it s best suited for a decorator and a state pattern. The high level setting is something like a sandwich maker and dispenser, where I have a set ...
I have been trying to execute a MS SQL Server stored procedure via JDBC today and have been unsuccessful thus far. The stored procedure has 1 input and 1 output parameter. With every combination I ...
I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...
If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...
I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....
I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...