• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Accesing an unshared folder using java

 
kranthi chamarthi
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Bartender
Posts: 1363
14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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()));
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic