• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Accesing an unshared folder using java

 
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Rancher
Posts: 5008
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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()));
 
My, my, aren't you a big fella. Here, have a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic