How to read file from remote machine

Hello,
Hi, i would like to know how to read text file from remote machine using java source code, any code ?
Thanks very much;
Best regards
Kim

On the server, perform the following steps:
Parse the request and determine the file to serve
Open a FileInputStream to the appropriate file
Obtain a reference to the Servlet OutputStream
Pipe the bytes from the file to the output stream
Flush and close the streamYou might want to call HttpServletResponse.setContentType("application/octet") to indicate to the browser that a file download will be occurring. Do so before getting the reference to the Servlet's OutputStream.
- Saish

Similar Messages

  • How to transfer files from virtual machine to host machine

    Hello, 
    I want to know how to copy files from virtual machine o host machine while the virtual machine running. I can't share files from virtual machine because i am just studying for mcsa in company computer. I can't connect my virtual machine to same network so
    i'm using a different ip range and i created a internal network switch for my virtual machines in hyper-v. Please give me a best solution for my studies.
    Regards,
    Ashane Deshapriya.
    Ashane Deshapriya ( MCP )

    Finally I got the solution...
    Here is how you can share files between a Hyper-V host and any virtual machines running on that host.
    If you've used Microsoft Virtual PC or Microsoft Virtual Server, you'll have enjoyed the fact that you can copy and paste between a virtual machine and those platforms. This doesn’t work with Hyper-V however—you can't copy/paste between a VM and the Hyper-V
    host.
    The workaround is to do the following:
    1. On your Hyper-V host, create a shared folder and assign Change permission to Everyone.
    2. On the virtual machine running on the host, open the Network and Sharing Center and enable File and Printer Sharing.
    3. On the virtual machine, click Start and type \\host_name\share_name where host_name is the name of your Hyper-V host and share_name is the name of the share you created.
    4. Press ENTER and an Explorer window will open in the VM showing the contents of the shared folder on the host.
    5. You can now copy files from the VM to the host and vice versa as needed.
    Regards.
    Ashane Deshapriya ( MCP )

  • [Urgent] How to read files from different directories?

    I am new to Java Programming, I would like to know how to read files from directories other than the current one? (example as follows)
    ProjectDirectory
    |--MainDirectory
    |--MainProgram.java
    |--SupplementDirectory
    |--SupplementProgram.java
    |--Pictures
    |--Image.gif
    What should I write in the MainProgram.java so that I can use the supplementProgram.java from MainProgram and read the Image.gif file from the MainProgram.java?
    Thanks

    Run through the I/O tutorial here. It should get you up to speed on this sort of thing...

  • How to restore files from Time Machine after Clean Install of Mavericks

    How to restore files from Time Machine after Clean Install of Mavericks. I know the data is there but seems unaccessable because I may have changed the Computer or Owner name. Is there any way to fix that now?

    Hi Linc,
    my back-up data is managed by Time Machine; the actual data is on a second internal Hard Drive with a capacity of 1TB - not partitioned. I am using Time Machine and have access to all data backed up since Mavericks Clean Install but not the data prior to this date.
    When I open the 1TB drive in Finder I can see a folder "Backups.backupdb/Sigi's Mac Pro/ followed by many folders of backup dates going back to 2010-09-20-103441 and up to 2014-02-07-142414 all followed with folder Macintosh HD.  February 7th  2014 was the date of the clean install.
    These Backups are followed by backup date folder 2014-02-08-075554 with a subfolder of MacPro-320GB (this is the name I assigned to my Boot Drive during formatting; I suspect I should have assigned the same name as before ie. Macintosh HD) and 2014-02-11 with a subfolder Macintosh HD, these are the ones I get access to by way of Time Machine > Restore.
    Weird thing is on Febr 11 when I relised my possible mistake and renamed the Bootdrive back to what it was initially ie. Macintosh HD despite this I have access to all backup data since the Clean Install in both folders MacPro-320GB as well as Macintosh HD but not to any data prior to the Clean Install.
    Is there something that Time Machine knows and prevents access or is it simply a matter of renaming the subfolder 2014-02-08-07554/MacPro-320GB to ........./Macintosh HD?
    I like to restore selectively and not everything - It was hard work reinstalling apps that were supposed to be the troublemakers (ref my discussion on Maverick problems) but I now need to get onto data specific to some of these apps as well as other data I may have missed. Long story? Yes and sorry.
    Sigi

  • HOw to delete files from remote server?

    Hi,
    I want to delete files from a directory on remote server.
    I use the following command to delete on current server:
    find $srcdir -mtime +90 -name "COR*.txt" -exec rm -f {} \;
    Now, how can I delete files from remote server ?
    Thanks!
    Yogini

    Some possible options:
    1. There exists SSH implementation for Windows.
    2. You can make a workaround. You can setup share for specific/wanted directory.
    Then you can mount it on Linux machine and execute command localy and delete files "localy" in mounted directory.
    3. You can setup FTP server on Windows machine and do that remotely via FTP commands.

  • Reading files from clients machine through a browser

    if i have to access or use some files say C:\hello\myimage.jpg from client machine's local drive, how it can be done using some technology in Java eg applets or some other way. please read the following situation to have a better undertsanding of the problem,
    consider the following situation:
    a web application is running on client PC, and on click of a button, i have to generate a report in some format and insert some images in that report which are on clients local drive and their path is known to me say C:\ myimage.jpg.
    if the mages were on the server(where web application is hosted), then its not a prob.
    if there any other technology in java to read files from clients PC through a browser other than java

    Sign the applet.
    http://forum.java.sun.com/thread.jspa?forumID=63&threadID=524815
    second and last post

  • How to delete file from client machine

    Hi all,
    we are using the DataBase: oracle:10g,
    and forms/reports 10g(developer suite 10g-10.1.2.2).
    can anybody help me how to delete the file from client machine in specified location using webutil or any
    (i tried with webutil_host & client_host but it is working for application server only)
    thank you.

    hi
    check this not tested.
    PROCEDURE OPEN_FILE (V_ID_DOC IN VARCHAR2)
    IS
    -- Open a stored document --
    LC$Cmd Varchar2(1280) ;
    LC$Nom Varchar2(1000) ;
    LC$Fic Varchar2(1280);
    LC$Path Varchar2(1280);
    LC$Sep Varchar2(1) ;
    LN$But Pls_Integer ;
    LB$Ok Boolean ;
    -- Current Process ID --
    ret WEBUTIL_HOST.PROCESS_ID ;
    V_FICHERO VARCHAR2(500);
    COMILLA VARCHAR2(4) := '''';
    BOTON NUMBER;
    MODO VARCHAR2(50);
    URL VARCHAR2(500);
    Begin
    V_FICHERO := V_ID_DOC;
    LC$Sep := '\';--WEBUTIL_FILE.Get_File_Separator ; -- 10g
    LC$Nom := V_FICHERO;--Substr( V_FICHERO, instr( V_FICHERO, LC$Sep, -1 ) + 1, 100 ) ;
    --LC$Path := CLIENT_WIN_API_ENVIRONMENT.Get_Temp_Directory ;
    LC$Path := 'C:';
    LC$Fic := LC$Path || LC$Sep || LC$Nom ;
    If Not webutil_file_transfer.DB_To_Client
    LC$Fic,
    'TABLE_NAME',
    'ITEM_NAME',
    'WHERE'
    ) Then
    Raise Form_trigger_Failure ;
    End if ;
    LC$Cmd := 'cmd /c start "" /MAX /WAIT "' || LC$Fic || '"' ;
    Ret := WEBUTIL_HOST.blocking( LC$Cmd ) ;
    LN$But := WEBUTIL_HOST.Get_return_Code( Ret ) ;
    If LN$But 0 Then
    Set_Alert_Property( 'ALER_STOP_1', TITLE, 'Host() command' ) ;
    Set_Alert_Property( 'ALER_STOP_1', ALERT_MESSAGE_TEXT, 'Host() command error : ' || To_Char( LN$But ) ) ;
    LN$But := Show_Alert( 'ALER_STOP_1' ) ;
    LB$Ok := WEBUTIL_FILE.DELETE_FILE( LC$Fic ) ;
    Raise Form_Trigger_Failure ;
    End if ;
    If Not webutil_file_transfer.Client_To_DB
    LC$Fic,
    'TABLE_NAME',
    'ITEM_NAME',
    'WHERE'
    ) Then
    NULL;
    Else
    Commit ;
    End if ;
    LB$Ok := WEBUTIL_FILE.DELETE_FILE( LC$Fic ) ;
    Exception
    When Form_Trigger_Failure Then
    Raise ;
    End ;sarah

  • How to upload file from client machine to  database in server machine?

    I am developing a web application. this application is suppose to take file from client machine and store that to database in the server side.
    My jsp form is of multi part type. but I am confused about what to write in servlet.
    Can any one help me ?
    Edited by: chinmaya_mishra on Feb 16, 2009 2:55 AM
    Edited by: chinmaya_mishra on Feb 16, 2009 2:58 AM

    http://www.google.com/search?q=jdbc+blob
    Blob processing varies between databases; see also examples for whatever database you are using, e.g.
    http://www.google.com/search?q=jdbc+blob+oracle
    If you are storing text data instead of binary data, replace "blob" by "clob" in the searches.

  • How to read file from server

    Hi,
    When i try to read file from server,the following message is displayed .
    ORA-29532: Java call terminated by uncaught Java exception: java.security.AccessControlException: the Permission (java.io.FilePermission /tmp read) has not been granted to EWMTRACKTEST. The PL/SQL to grant this is dbms_java.grant_permission( 'EWMTRACKTEST', 'SYS:java.io.FilePermission', ' /tmp', 'read' )
    ORA-06512: at "EWMTRACKTEST.GET_DIRLIST_EWM", line 1
    ORA-06512: at line 1
    thanks and regards
    P Prakash

    it seems obvious, user EWMTRACKTEST doesn`t have access to directory /tmp and the file under that.
    try to give read permission and try again.
    you could use command line like 'chmod' to grant permissions.

  • How to bring files from time machine (ext drive) to another mac?

    Getting another Mac and need to install specific files from a Time Machine Backup of another Mac.
    Has anyone done this without Time Machine doing a full restore on the new Mac? I'd like to bring over items such as: preferences, Mail files, Safari bookmarks, pictures, etc.
    Thanks.

    I am not adverse to using migration assistant.
    With your suggestion, among others I shall. However, I think it is better to load applications from my DVD's into the new Mac, then open and use the migration assistant. Don't you agree?
    Otherwise, I think, the migration assistant on initial startup of the new Mac will migrate files that do not have apps already installed. Maybe that does not matte?? Does it will migrate over apps first? All shall come from my TM backup which I am concerned were from a Power PC G5, to now to run on an Intel based Mac, and I thought it best to load apps without any touch from the PPC.
    Please, tell me if I do not need to install apps first and then run migration assistant. Thanks to all...

  • How to upload file from one machine (windows) to another (linux)through cre

    How to upload a file from windows platform to linux platform.
    on both platforms sun app server is running.
    from creator is there any methode to open ftp port and upload

    http://www.google.com/search?q=jdbc+blob
    Blob processing varies between databases; see also examples for whatever database you are using, e.g.
    http://www.google.com/search?q=jdbc+blob+oracle
    If you are storing text data instead of binary data, replace "blob" by "clob" in the searches.

  • How to read file from prsntn server in Inbound idoc FM.

    Hi Experts,
    I am new to idoc.
    I have requirment that i need to read a file from presentation and application server and put in inbound idoc FM.Idoc will be processed in batch.
    How can i put selection screen in FM and read the file?or how can i proceed  with the solution?
    Please help..
    Umesh

    Hi Umesh,
    My understanding on your requirement is to read a file from pres. server and pass the data to an IDoc function module. Am I correct?
    If this is the case then you can create a report which picks up the file from pres. server and then read data from the file and pass it to the parameters of the required function module.
    Hope this helps.
    Regards,
    -Sandeep

  • How to read file from server if I have a logical file path?

    Hi guys,
    I'm having a pretty "on the run" question,
    My program is currently reading a file from server using "open dataset" with file path like this (just example)
    /usr/interface/abc/bcd/testfile.dat
    Now I got a requirement to make it more consistent to read files, instead of reading that physical file name, I should read the files from a specific folder using logical path.
    So I go to T code "FILE" and created a logical path called ZABC_FILE_PATH, unix compatible, with physical path is (for example),
    /usr/interface/<sysid>/<client>/<filename>
    My question is, can I still use open dataset statement to read this? if yes, how do I do that? If no, there should be alternative way, please let me know what you think. Thanks,

    Thanks all, I figured it out.
    ONe thing is that typo double quote
    The other thing is the importing part, I need the full file path.
    CALL FUNCTION 'FILE_GET_NAME_USING_PATH'
      EXPORTING
        CLIENT                           = SY-MANDT
        logical_path                     = 'ZABC_MY_LOGICAL_FILE_PATH'
    *   OPERATING_SYSTEM                 = SY-OPSYS
    *   PARAMETER_1                      = ' '
    *   PARAMETER_2                      = ' '
    *   PARAMETER_3                      = ' '
    *   USE_BUFFER                       = ' '
        file_name                        =  v_1
    *   USE_PRESENTATION_SERVER          = ' '
    *   ELEMINATE_BLANKS                 = 'X'
      IMPORTING
        FILE_NAME_WITH_PATH              = v_what_I_need
    * EXCEPTIONS
    *   PATH_NOT_FOUND                   = 1
    *   MISSING_PARAMETER                = 2
    *   OPERATING_SYSTEM_NOT_FOUND       = 3
    *   FILE_SYSTEM_NOT_FOUND            = 4
    *   OTHERS                           = 5
    I really appreciate your contributions, thanks again!

  • How to read files from MIT-BIH arrhythmia database using labview

    hello friends,
    How can i read the files from MIT-BIH arrhythmia database using labview 8.6. These file extensions are in different format ie is .atr, .dat and .hea
     The link for the following database is below, any example vi for reading this data in labview would be very useful.
    http://www.physionet.org/physiobank/database/mitdb​/
    Message Edited by infra444 on 01-27-2009 07:01 AM

    You will find some help here.
    http://www.physionet.org/physiotools/matlab/#wfdb
    Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
    (Sorry no Labview "brag list" so far)

  • How to read files from cq5..

    Hi,
    Here i want to get a pdf file from the "/content/myproj-data/docs/demo.pdf" path and then want to convert this into images...(I am using cq5.6.1)
    Whenever i started this process using the File I/O stream, i am not able to get the pdf file from the above path .....whenver i took from the static localpath (d://files/demo.pdf) i am able to fulfill my requirement ..
    Here whats happening is, when pass /content/myproj-data/docs/demo.pdf to the InputStream , it is changing as "\content\myproj-data\docs\demo.pdf" (Instead of "/" itz taking "\").
    Is there a better way to read pdf file from cq5 and convert into image??
    Please share!!!
    Thanks in advance
    Sony C.

    what kind is the different machine?
    if it is UNIX,you can use following code:
    URL url = new URL("ftp",server,port,file);
    InputStream reader = url.openStream();
    reader.read()
    if it is windows,you may be need to install a FTP agent.

Maybe you are looking for

  • Java - SQL Server 2000 Connectivity

    hi all. i m looking for help in Java - SQL Server 2000 Connectivity.i worked on Java- Oracle & Java - MS Access format.now i m looking to work on Java - SQL Server 2000. I m using JBuilder 2005. can any1 help me how to make any change(configuration)

  • List Component Links

    I have created AS3 script for loading and parsing an RSS feed. I have successfully displayed the "title" node on the stage in a List Component with the instance name "blogList". Now I wish to use the corresponding "Link" node so that each item in the

  • Wait Time & Roll Wait Time

    In t-code ST03N, there are following info: 1. Average Wait Time per Dialog Step (ms) 2. Average Roll In Time (ms) 3. Average Roll Wait Time (ms) Question: 1. When will Roll Wait happen? 2. What is relationship between Wait Time and Roll Wait Time? 3.

  • Percent preloader for video flv's?

    How do you code a preloader for an flv video that has a play head that starts as the preloader is running then the video starts playing? like on the following site in their work section: http://www.natl.tv/ thx

  • How to copy the value of object in jdk 1.6

    Hi, I want to copy a object from another with out reference. clone(0 is not accessable , only can use super.clone() , but if my class don't have the clone() method at all then .. can any body tell me how i can do this.. thanks in advance