Solved

Java: Read a shortcut file present in network drive

Posted on 2011-03-09
3
636 Views
Last Modified: 2013-11-23
File f = new File("\\\\bady\\SShare\\mart.xml");
Here mart.xml is a shortcut present in C:\Param\Bin
I get a java.io.FileNotFoundException:\\\\bady\\SShare\\mart.xml (The system cannot find the file specified)
0
Comment
Question by:gpmattoo8
  • 2
3 Comments
 
LVL 47

Expert Comment

by:for_yan
ID: 35080413
If it is in C:\param\bin why would not you read it as File f = new File("c:\\Param\\bin\\mart.xml"); - ?
0
 
LVL 1

Expert Comment

by:DColclazier
ID: 35080452
They are probably trying to reference the network location rather than a local logical drive - makes sense.  Can you access the file via alternate methods (explorer) using the same UNC?
0
 
LVL 47

Accepted Solution

by:
for_yan earned 50 total points
ID: 35080544
You need either map some part of the UNC path as a drive (under some letter) or, I guess, you can open stream from URL using file: protocol:
file://bady/SShare/mart.xml
I didn't try the last variant but hope it should work analogously to http: proticol, but does not need http server
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Weekend adv creator 3 64
mysql jsp example issue 32 70
swing controls 2 21
collection output issue 9 61
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question