This week's book giveaway is in the Java in General forum.
We're giving away four copies of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 and have ishori Sharan & Adam L Davis on-line!
See this thread for details.
Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

java networking. Remote file's last modified date

 
Greenhorn
Posts: 18
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 !!
 
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Scott. This was useful.
 
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic