This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes java networking. Remote file's last modified date Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "java networking. Remote file Watch "java networking. Remote file New topic
Author

java networking. Remote file's last modified date

Gopal Krishna
Greenhorn

Joined: Aug 31, 2002
Posts: 18
    
    1
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

Joined: Sep 23, 2004
Posts: 245
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.


<a href="http://forums.hotjoe.com/forums/list.page" target="_blank" rel="nofollow">Java forums using Java software</a> - Come and help get them started.
Gopal Krishna
Greenhorn

Joined: Aug 31, 2002
Posts: 18
    
    1
Thanks Scott. This was useful.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java networking. Remote file's last modified date
 
Similar Threads
Writing to a file on the server whose URL is given
JNDI lookup problem
specify path build.properties of ant
Websphere MQ with JAAS
Reading a zip file