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 connecting to shared folder in windows 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 "connecting to shared folder in windows" Watch "connecting to shared folder in windows" New topic
Author

connecting to shared folder in windows

Sherif Shehab
Ranch Hand

Joined: Mar 05, 2007
Posts: 483

Hi Guys ,

I need to connect to a shared folder on a remote windows machine through java , where i put my domain authentication (username and password ) in the code , here is my code


Please advice ...


Thanks,
Sherif
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19654
    
  18

Check out JCIFS. Your code would work if you didn't need to connect with a different user name / password than those you logged into Windows with.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Sherif Shehab
Ranch Hand

Joined: Mar 05, 2007
Posts: 483

Rob Prime wrote:Check out JCIFS. Your code would work if you didn't need to connect with a different user name / password than those you logged into Windows with.


Thanks for your reply , Ya you are right , but actually i need to connect using username and password , do you think JCIFS will help, no other way without using JCIFS? ,any tutorials for it ?
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19654
    
  18

Main page
Javadoc (you will want jcifs.smb.SmbFile)

After that it should be pretty easy; use SmbFile where you normally use java.io.File. The rest is more or less the same, only SmbFile has its own methods for getting an input or output stream to it, instead of separate classes FileInputStream and FileOutputStream.
Sherif Shehab
Ranch Hand

Joined: Mar 05, 2007
Posts: 483

HI ,

I used the JCIFS but when ii'm trying to connect i got this exception :

although i;m sure from the username and password !!

Here is my code :


Anything i'm missing ?
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: connecting to shared folder in windows
 
Similar Threads
split a file to original files
Find windows special folders
Running an application of 3 classess in JCreator
Couldn't delete all files older than X days
exe file to get the property of the files in a folder