Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Beginning Java and the fly likes how to copy file in java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "how to copy file in java" Watch "how to copy file in java" New topic
Author

how to copy file in java

Bilal Ali
Ranch Hand

Joined: Jun 14, 2007
Posts: 66
Dear All,
We have java class files deployed on our server (Tomcat) , the server is linux based , we also have 4 WINDOWS clients , the java file contains the logic of creating file on the server , now the thing in which I am stucked is that how to copy this file from LINUX server to WINDOWS client machine , please guide.
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

You can just let the clients download the file using HTTP, right?


[Jess in Action][AskingGoodQuestions]
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14352
    
  22

In more detail:
  • Put the file somewhere on the server where it's accessible by Tomcat.
  • Present the user with a web page containing a link that points to the file on the server.
  • The user clicks on the link and saves the file on his/her disk using the browser.


  • Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
    Bilal Ali
    Ranch Hand

    Joined: Jun 14, 2007
    Posts: 66
    Originally posted by Jesper Young:
    In more detail:
  • Put the file somewhere on the server where it's accessible by Tomcat.
  • Present the user with a web page containing a link that points to the file on the server.
  • The user clicks on the link and saves the file on his/her disk using the browser.

  • I tryed this approach but ather than asking for the save option the whole file in opoened in the browser.I mean to say that all of the text of the file is displayed on browser window/page rather than asking me for the save or open option.
    Ananth Chellathurai
    Ranch Hand

    Joined: Nov 21, 2007
    Posts: 349

    Are you aware of the file type? Will it be the same?

    Regards
    Ananth Chellathurai


    Ananth Chellathurai [Walk on software]
    Bilal Ali
    Ranch Hand

    Joined: Jun 14, 2007
    Posts: 66
    Originally posted by Ananth Chellathurai:
    Are you aware of the file type? Will it be the same?

    Regards
    Ananth Chellathurai


    This is a text file and it will not change.
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: how to copy file in java