0

I get the strangest thing going on... I have a JSP file which read a file from given path, but somehow the http:// is changed to http:\

BufferedReader in = new BufferedReader(new FileReader("http://server/path/file.sql"));

the exception i get is: (the file exist for sure!!! works when url is entered in webrowser).

exception=http:\server\path\file.sql (The filename, directory name, or volume label syntax is incorrect)
Bozho
  • 588,226
  • 146
  • 1,060
  • 1,140
Noam Shaish
  • 1,613
  • 2
  • 16
  • 37

1 Answers1

1

Use new InputStreamReader(new URL("http://....").openStream(), "UTF-8")

FileReader is used to read the filesystem, not URLs. Also have in mind that writing java code in JSP is usually not a good idea. See here

Community
  • 1
  • 1
Bozho
  • 588,226
  • 146
  • 1,060
  • 1,140