Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java networking. Remote file's last modified date

 
Gopal Krishna
Greenhorn
Posts: 18
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to read files on a remote machine for which i have read access. I can access these file from my windows xp m/c using am url of type

file:\\machine_name\e\j2skd1.4.2\lib

but when i try to access these using java.net.URL i get varying results.

with Eclipse jdk when i use the below URL

URL u = new URL( "file:\\\\machine_name\\e\\j2skd1.4.2\\lib");

I am able to retrieve the contents of the lib folder in an HTML format.

with jdk 1.4 i get the below exception

java.net.ConnectException: Connection refused: connect

What is the URL format i should be using with Sun's jdk to be able to retrieve the contents of a directory ?
Thank you !!
 
Scott Dunbar
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This isn't really Java networking. The first problem you have is that file: expects forward slashes only after the colon like file:/. Next, I think (and this I can't test right now I'm afraid) that you're better off using forward slashes for all of the slashes. Windows will translate it correctly.
 
Gopal Krishna
Greenhorn
Posts: 18
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Scott. This was useful.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic