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 I/O and Streams and the fly likes Accesing an unshared folder using java 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 » I/O and Streams
Bookmark "Accesing an unshared folder using java" Watch "Accesing an unshared folder using java" New topic
Author

Accesing an unshared folder using java

kranthi chamarthi
Ranch Hand

Joined: May 08, 2007
Posts: 95
Hi,
In our application,there are three servers
1)Application Server
2)File server
3)Database server
The files that are uploaded by user will be uploaded on to the file server and the uploaded content(video files) should be served by the application server.Now the problem is, if the application server is restarted(due to some reason) then it is not able to access the content on file server until manually the folder is accessed from the application server(by giving the ipaddress/c$ and giving the credentials).From then on, the application server will be able to access the file server.Now i want to do this programatically(checking if the file server folder is accessible from the application server before uploading ,and if the folder is not accessible then supplying the login credentials).Can some one suggest me the solution.
Thanks in advance.
Norm Radder
Ranch Hand

Joined: Aug 10, 2005
Posts: 685
If you have a commandline you want to execute from a java program you could use the Runtime class's exec() method. There are many posts with examples of how to do this. For example:

Runtime.getRuntime().exec("Command.com /c dir T*.java > TestDOSCMD.txt");

If you need to see the results, use the Process class with the above:

Process proc = Runtime.getRuntime().exec("command.com /c CD E:");
BufferedReader br = new BufferedReader(
new InputStreamReader(proc.getInputStream()));
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Accesing an unshared folder using java
 
Similar Threads
How to bind images and text together in same jsp page in easiest way?
Accesing Files stored on remote server by using Credentials
opening .xls file using jsp
Include HTML as static resource
Accessing File on UNIX