• Post Reply Bookmark Topic Watch Topic
  • New Topic

Illegal character in URI

 
meeta gaur
Ranch Hand
Posts: 305
Notepad Tomcat Server Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Exception in thread "main" java.lang.IllegalArgumentException: Illegal character in opaque part at index 5: file:\\D:\uri.txt
at java.net.URI.create(URI.java:859)
at CreatePath.main(CreatePath.java:12)
Caused by: java.net.URISyntaxException: Illegal character in opaque part at index 5: file:\\D:\uri.txt
at java.net.URI$Parser.fail(URI.java:2829)
at java.net.URI$Parser.checkChars(URI.java:3002)
at java.net.URI$Parser.parse(URI.java:3039)
at java.net.URI.<init>(URI.java:595)
at java.net.URI.create(URI.java:857)
... 1 more

Help please, i'm using windows xp.
 
Paul Clapham
Sheriff
Posts: 21862
36
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The URI isn't even well-formatted because you used backslashes instead of slashes. The message tells you that: what character is at "index 5" in your URI?
 
meeta gaur
Ranch Hand
Posts: 305
Notepad Tomcat Server Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Clapham wrote:The URI isn't even well-formatted because you used backslashes instead of slashes. The message tells you that: what character is at "index 5" in your URI?


The character used to separate the directory names (also called the delimiter) is specific to the file system: The Solaris OS uses the forward slash (/), and Microsoft Windows uses the backslash slash (\).


So i thought i should use backslash.

http://docs.oracle.com/javase/tutorial/essential/io/path.html
 
Paul Clapham
Sheriff
Posts: 21862
36
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But that documentation you linked to is about file paths, not about URIs.
 
meeta gaur
Ranch Hand
Posts: 305
Notepad Tomcat Server Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Clapham wrote:But that documentation you linked to is about file paths, not about URIs.


Yes, you were correct,In URI forward slash is working not backward.Thank you :thumbup:
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!