Skip to Main Content

Java APIs

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to access remote file of other domain?

843790Nov 30 2009 — edited Jan 27 2010
Hi All,

I want to access a remote file which is in another domain. Following is the environment (all Windows machine):

Following two domains have been created

1. Domain1: test
* user: abcuser
* Shared folder: abcuser
o Share Rights: Full Control for Everyone
2. Domain2: abc
* user: testabc

Now I want to upload a file at shared folder abcuser (Domain1) thru my application which is running on a machine in Domain2 where I launch the application thru services. For uploading the file I am simply creating a FileOutputStream by specifying the shared path to its constructor.
Following are the cases when the upload works i.e

* When the shared location is in the same domain and

* Change the user with which my application start from Local System account to the domain account.


Now, I want to know is there any way by which I still launch the application from Local System account but provide the user credentials (userName/pasword for Doamin2 user) at runtime to allow access to the shared location. I tried it thru the usage of File and FileInputStream but it dint work as java.io.File takes URI with undefined authority (i.e. If I specify username:password it throws exception).

Can anyone suggest me any other way.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 24 2010
Added on Nov 30 2009
16 comments
954 views