The Artima Developer Community
Sponsored Link

Java Answers Forum
Java IO problems

2 replies on 1 page. Most recent reply: Aug 19, 2005 6:07 AM by priya

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 2 replies on 1 page
priya

Posts: 2
Nickname: priya1
Registered: Aug, 2005

Java IO problems Posted: Aug 18, 2005 9:58 AM
Reply to this message Reply
Advertisement
Hi all,

I have mapped my network drive to another machine and then I use the File class in java to check if a particular file/folder exists in that directory.

eg. Say I have mapped a drive M:/test/application.
and I want to access the folder testingMap in the application folder of the mapped drive.

Now in some machine the line File.exists() checking for the presence of the testingMap folder return true and some machines it returns false.

Can someone throw some light on why this should happen when we are using the exact same code in both machines?

The environment is different. In one machine its NTFS file system and another its Samba based.

My question is how to go about fixing this issue? Is there any alternative way to do the same. I have also tried creating the file using URI option. The same problem persists. The line file.exists() returns false(no exceptions) even though I can see the folder in the system.When can this happen

I really appreciate your response.


Thanks,


Kondwani Mkandawire

Posts: 530
Nickname: spike
Registered: Aug, 2004

Re: Java IO problems Posted: Aug 19, 2005 12:09 AM
Reply to this message Reply
A shot in the dark here - i.e. its just a guess based
on glue logic (wrt what I have used) but shouldn't
regular IO operations only have access to stuff on
the local file system. Even if you map a drive to
your PC, its still not local - I don't think it
resides on the local file system. Unless you are
using classes of the *.net package, I don't see
how you should be able to access that Folder.

Yes you will see it by going to dos and typing
M:
cd my_shared_folder

But I don't think Java's regular I/O functions
will be able to access it.

You will definitely have to access it via java.net.*
modules. If in the String the URI you entered
is M:\blah\blah\blah

That will obviously not work either coz that will
probably not be understood as a path.

You will have to connect via Client\Server type
code and hopefully run a server like tomcat putting
the file in a directory that is accessible, last
time I toyed with that it was a director called web.

Or write your own server and if I'm not mistaken
you could be able to designate a directory by means
of your server that will be accessible to Client
requests.

Once again I may be wrong, but this is the only
explanation that makes sense. Mapping to me
seems to be a simple Windows Hack and remains that.

On the flip side if you play around with Google
there may be some implementations that you may use
that take advantage of the Mapping facility - but
I'm nto aware of any.

Spike

priya

Posts: 2
Nickname: priya1
Registered: Aug, 2005

Re: Java IO problems Posted: Aug 19, 2005 6:07 AM
Reply to this message Reply
Hi,

I have tried using the URI option to access the files in the other system. My question is how is it able to see the mapped drives on some machines and not able to see the mapped drives on some others.How to fix this issue?

Appreciate your help

Thanks,

Flat View: This topic has 2 replies on 1 page
Topic: how should i append data to file by overwriting the one's already existing? Previous Topic   Next Topic Topic: UML CASE Tool - Integrate with the Most Popular IDEs

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use