• 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

Creating File on other System

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Friends,

I am writing a Java application where I want to access a File which is on other machine(System).

For e.g. To create a file on the local machine I can use,
File file = new File("C:\\Temp\\test.txt");

But what if I want to create file in the same path, but on different System whose IP Address is say 10.1.1.1 or machine name is TestServer

Thanks & Regards,
Ketan
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If the other machine is a Windows machine, you can use a shared volume. The jCIFS library (jcifs.samba.org) could be used for accessing a Samba server (or any other SMB volume).
 
Ranch Hand
Posts: 961
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, it is not very clear if you simply want to save a file in a path in another machine, or if you actually would like to transfer a file from one machine to the other.

In the latter case you could use a socket to transfer the file from the client to a server. Obviously, the user running the JVM for the server application must have privileges to write a file in the path that you want to save the file.

However, if what you ask is how to save a file in a different path on another machine, then, probably all you need to do is to share some resources over your network, like the previous post seems to suggest.
 
reply
    Bookmark Topic Watch Topic
  • New Topic