How to view file on server.

Hello
I am developing a small client server application.Clients post comments about the application and these are stored in a file on the server.Its a standalone app.My question is if a client wants to view the file on server,how can i do that??
Any help/suggestions will be appreciated.
thanks
Sree.

I tried doing that but i get an exception
java.net.SocketException: Software caused connection abort: socket write error .
by google i found that this was due to a bug but has been fixed on JRE 1.5(i'm using JRE 1.6) but i still get this.
here is my code:package com;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.MalformedURLException;
import java.net.ServerSocket;
import java.net.Socket;
public class TestServer_New
     public static void main(String args[])
          ServerSocket server = null;
          boolean listening = true;
          final String filename = "comments";
          try {
               server = new ServerSocket(4321);
          catch (MalformedURLException e1) {
               e1.printStackTrace();
          catch (IOException e) {
               System.out.println("Error on port: 4321 " + ", " + e);
               System.exit(1);
          System.out.println("Server setup and waiting for client connection ...");
          try
               while( listening ) {
                    final Socket client_socket = server.accept();
                    System.out.println("Client connection accepted. Moving to local port ...");
                    new Thread( new Runnable() {
                         public void run() {
                              write_to_comments(client_socket, filename);
                         }}).start();
               server.close();
          catch (IOException e)
               System.out.println("Did not accept connection: " + e);
               System.exit(1);
     static synchronized void  write_to_comments(Socket client_socket , String filename) {
          try {
               BufferedReader streamIn = new BufferedReader(new InputStreamReader(client_socket.getInputStream()));
               BufferedReader file_reader = new BufferedReader(new InputStreamReader(new FileInputStream(filename)));
               BufferedWriter server_file_writer = new BufferedWriter(new FileWriter(filename,true));
               BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(client_socket.getOutputStream()));
               String line ;
//               while((line = streamIn.readLine()) != null){
//                    if(!line.equals("view comments")){
//                         server_file_writer.write(line);
//                         server_file_writer.newLine();
//                         System.out.println("write to comments request from client "+line);
//                    else{
                         while ((line = file_reader.readLine()) != null){
                              writer.write(line);
                              writer.newLine();
                              System.out.println("view comments request from client "+line);
               writer.newLine();
               writer.close();
//               send_data_to_client(client_socket,filename);
//               streamIn.close();
//               client_socket.close();
          catch(IOException exception){
               exception.printStackTrace();
               System.out.println("IO Error in streams " + exception);
}here is the client code
     void send_comments_to_server(){
          DataOutputStream output_stream;
          String host = "C001192097";     //server host name
          try {
               Socket client = new Socket(host, 4321);
               output_stream = new DataOutputStream(client.getOutputStream());
               BufferedReader stream_input = new BufferedReader(new InputStreamReader(client.getInputStream()));
               BufferedWriter writer = new BufferedWriter(new FileWriter("commentsfromserver",false));
               XStream xstream = new XStream_Data_Analyser();
               String comment_report = get_title_text_field().getText();
               Comments comment = new Comments();
               User_Data user_data = new User_Data();
               String user_info = "User Name: "+user_data.user_name+" "+"Host Name: "+user_data.host_name+" "+"Domain Name: "+ user_data.domain_name;
               comment.user_info = user_info;
               comment.summary = comment_report;
               comment.comments = get_comments_text_area().getText();
               String report = xstream.toXML(comment);
               String line;
               if (view_comments == true){
                    output_stream.writeBytes("view comments");
                    view_comments = false;
//               else{
//                    output_stream.writeBytes(report+"\n");
               while((line = stream_input.readLine()) != null){
                         writer.write(line);
                         writer.newLine();
                         System.out.println("data received from server "+line);
//               output_stream.close();
//               stream_input.close();
//               client.close();
          }catch (UnknownHostException exception){
               System.err.println(host + ": unknown host.");
          catch (IOException exception){
               System.err.println("I/O error with " + host);
               exception.printStackTrace();
     }and this is the exception msg i get:
java.net.SocketException: Software caused connection abort: socket write error
     at java.net.SocketOutputStream.socketWrite0(Native Method)
     at java.net.SocketOutputStream.socketWrite(Unknown Source)
     at java.net.SocketOutputStream.write(Unknown Source)
     at java.io.DataOutputStream.writeBytes(Unknown Source)
     at data_analyser.Improvements_Dialog.send_comments_to_server(Improvements_Dialog.java:131)
     at data_analyser.Improvements_Dialog$2.actionPerformed(Improvements_Dialog.java:170)
     at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
     at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
     at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
     at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
     at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
     at java.awt.Component.processMouseEvent(Unknown Source)
     at javax.swing.JComponent.processMouseEvent(Unknown Source)
     at java.awt.Component.processEvent(Unknown Source)
     at java.awt.Container.processEvent(Unknown Source)
     at java.awt.Component.dispatchEventImpl(Unknown Source)
     at java.awt.Container.dispatchEventImpl(Unknown Source)
     at java.awt.Component.dispatchEvent(Unknown Source)
     at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
     at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
     at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
     at java.awt.Container.dispatchEventImpl(Unknown Source)
     at java.awt.Window.dispatchEventImpl(Unknown Source)
     at java.awt.Component.dispatchEvent(Unknown Source)
     at java.awt.EventQueue.dispatchEvent(Unknown Source)
     at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
     at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
     at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
     at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
     at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
     at java.awt.EventDispatchThread.run(Unknown Source)
thanks for your help
sree
Edited by: sreecs on Sep 17, 2008 5:13 PM

Similar Messages

  • How to get file from server while click on link

    Hi,
    i created on link and i gave one server path to select file from server but while clickinng on link it no displaying any thing.
    following is the Destination url that i gave for the item.
    /u08/app/appvis/xxex/inst/xxex_apps/xxrbe/logs/appl/conc/log/
    please tell me how to get file from server while click on link.

    Ok I got your requirement now.
    If you are getting file names from view attribute then you should not be adding destination URI property for the link.
    Instead you can use OADataBoundValueViewObject API.
    Try below code in your controller processRequest method:
    I am assuming that you are using classic table.
    Also in below example it considers OAMessageStyleText and you can replace it with link item if you want.
    OATableBean tableBean =
    (OATableBean)webBean.findChildRecursive("<table item id>");
    OAMessageStyledTextBean m= (OAMessageStyledTextBean)tableBean.findChildRecursive("<message styled text in table item id>");
    OADataBoundValueViewObject tip1 = new OADataBoundValueViewObject(m, "/u08/app/appvis/xxex/inst/xxex_apps/xxrbe/logs/appl/conc/log/"+"<vo attr name which stores file name for each row>");
    m.setAttributeValue(oracle.cabo.ui.UIConstants.DESTINATION_ATTR, tip1);
    Regards,
    Sandeep M.

  • How to view files uploaded in a directory through jsf

    Please tell how to view the files in a directory using adf .Using jdeveloper 10g

    Hi,
    I assume the user has a directory on the server where his/her files go. In this case, you can use Java in a managed bean to access the folder and create a collection of the entries.
    http://www.exampledepot.com/egs/java.io/GetFiles.html
    Frank

  • How to view  file in EBS R12

    Hi,
    I have a report output file report1.pdf coming from windows.
    I ftp it to our EBS R12 linux server to the desired location.
    How can I view it using the "view request" of the EBS CM?
    Thanks a lot

    Hi,
    What do you mean by how to view the report? If you register the concurrent program, then you should be able to view the output using Acrobat Reader (since the type is PDF).
    In addition, you should not upload the output file (.pdf), instead upload the rdf file under $PRODUCT_TOP/reports/<lang> directory.
    Regards,
    Hussein

  • 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 upload file on server

    Hi every1,
    I have the following problem:
    I need to store information in files on server, how can I upload a file to a server into a specified directory??
    Tnx in advance,
    Mort

    //the server side
    ServerSocket acceptSocket = new ServerSocket(port);
    while(true) {
    Socket s = acceptSocket.accept();
    Connect(s);
    } // waits for client socket
    void Connect(Socket s) {
    in = new ObjectInputStream(s.getInputStream());
    } // you can create a file object on the client side and send it through an object stream. You should probably make sure that file objects are synchronized. They most likely are. I've never tried this, but there's no reason why it wouldn't work. Make sure to start the output stream before the input stream or you'll get a hang up.
    //the client side
    s = new Socket(InetAddress ip,int port);
    out = new ObjectOutputStream(s.getOutputStream());
    out.writeObject(File file); //write the file object to the output stream

  • How to view Files inside File manager in N73

    I wanted a video of .avi or any other format (For my computer) that N73 Doesnot support..& so i have got it in my inbox via bluetooth inside inbox.
    But how to SAVE it without opening it.
    Becoz on opening it says UNKNOWN FILE FORMAT.
    So any one can tell me how to view it and save inside Phone or directly to computer via USB cable.
    Shashank RockZzzzzz...With N73 (23)
    v4.0726.2.1.1
    27-07-2007
    RM132

    any help will be appriciated
    Shashank RockZzzzzz...With N73 (23)
    v4.0726.2.1.1
    27-07-2007
    RM132

  • Installed iTunes 11.4.0 and cannot find how to view files created by apps or screen displays for moving icons.  Where did it go?

    I recently installed iTunes 11.4.0 and cannot find how to view the files created by some apps on my iPhone (and iPad).  There appears to be no way to view them as there was in the previous version.  Also can't view screens and icon positons to manipulate them in iTunes.  Any one no how to find them, or if they have been purposely removed from 11.4.0?

    First, take a deep breath ... enjoy life.
    Upgrade to the latest version 1.4.1. It's a free upgrade. It however will not alleviate your frustrations.
    You can move a directory in Lr by clicking and dragging to a new location within the Folders panel. To create a new folder on a new drive ensure that no folders are selected (hint: click All Photographs in the Catalog panel) then click the + icon in the Folders panel. You will be presented with a dialog to choose or create a new folder.
    To move selected photos to a new directory first select the images then right click the destination folder. You will be presented with several options including moving to the destination folder or creating a new folder under the destination folder.
    You can also move images outside of Lr. Review these links:
    http://www.adobeforums.com/webx/.3bc42055
    http://livedocs.adobe.com/en_US/Lightroom/1.0/help.html?content=WS46FF9C0B-36EA-4271-B1D0- 07B6B46EE011.html
    http://photo.net/bboard/q-and-a-fetch-msg?msg_id=00NqWO
    http://luckhurst.wordpress.com/2007/08/21/lightroom-with-an-external-hard-drive/

  • How to transfer file from server to client

    I am making a server printer where all the system can take print out from the Printer installed on the server
    i am not able to send file from the client to the Server. I am Attaching the code Please Help me it is my college project.
    Server.java*
    import java.io.*;
    import java.lang.*;
    import java.net.*;
    import java.util.*;
    import java.io.File;
    class Server
         static final int PORT     = 26548; //Server Listening port
         static String path;
         public static void main(String args[])
              System.out.println("Starting Server");
              receive();
         public static void receive()
              while ( true )
                   try
                        //Create a socket
                        ServerSocket srvr = new ServerSocket(PORT);
                        Socket skt = srvr.accept();
                        String clientname= skt.getInetAddress().getHostAddress();
                        int clientport=skt.getPort();
                        long time = System.currentTimeMillis();
                        path= "C:\\Ankit Gupta\\Programs\\"+clientname+"\\"+time+" test.pdf";
                        System.out.println("File Recieved from : "+clientname+" : "+clientport);
                        //HttpServletRequest req;
                        //String remoteHost = req.getRemoteHost();
                        //String adr = getRemoteUser();
                        FileOutputStream fos = new FileOutputStream(path);
                        BufferedOutputStream out = new BufferedOutputStream(fos);
                        BufferedInputStream in = new BufferedInputStream( skt.getInputStream() );
                        //Read, and write the file to the socket
                        int i;
                        System.out.println("Receiving data...");
                        while ((i = in.read()) != -1)
                             out.write(i);
                        out.flush();
                        in.close();
                        out.close();
                        skt.close();
                        srvr.close();
                        System.out.println("Transfer complete.");
                        printfile();
                   catch(Exception e)
                        System.out.print("Error! It didn't work! " + e + "\n");
                   try
                        Thread.sleep(1000);
                   catch (InterruptedException ie)
                        System.err.println("Interrupted");
              } //end infinite while loop
         public static void printfile()
              delete();
         public static void delete()
              try
                   Thread.sleep(5000);
              catch (InterruptedException ie)
                   System.err.println("Interrupted");
              System.out.println("Deleting file");
              File f = new File(path);
         // Make sure the file or directory exists and isn't write protected
              if (!f.exists())
                   throw new IllegalArgumentException("Delete: no such file or directory: " + path);
         if (!f.canWrite())
                   throw new IllegalArgumentException("Delete: write protected: "+ path);
              // If it is a directory, make sure it is empty
         if (f.isDirectory())
                   String[] files = f.list();
                   if (files.length > 0)
                   throw new IllegalArgumentException("Delete: directory not empty: " + path);
         // Attempt to delete it
              boolean success = f.delete();
              if (!success)
                   throw new IllegalArgumentException("Delete: deletion failed");
    Client.java_
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.io.*;
    import java.util.*;
    import java.net.*;
    public class Client extends JFrame {
    static final int PORT = 26548; //Server Listening Port
    static File file;
    static final String HOST = "10.35.9.152";//Server Address     
    JTextField m_fileNameTF = new JTextField(25);
    JFileChooser m_fileChooser = new JFileChooser();
    Client() {
    m_fileNameTF.setEditable(false);
         JButton openButton = new JButton("Open");
         openButton.addActionListener(new OpenAction());
         JPanel content = new JPanel();
         content.setLayout(new FlowLayout());
         content.add(openButton);
    content.add(m_fileNameTF);
         this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         this.setContentPane(content);
         this.setSize(400,200);
    class OpenAction implements ActionListener {
         public void actionPerformed(ActionEvent ae) {
              int retval = m_fileChooser.showOpenDialog(Client.this);
              if (retval == JFileChooser.APPROVE_OPTION) {
                   file = m_fileChooser.getSelectedFile();
              m_fileNameTF.setText(file.getAbsolutePath());
                   send(file.getAbsolutePath());
    public static void main(String[] args) {
         JFrame window = new Client();
         window.setVisible(true);
         public static boolean send( String filename )
         try
              System.out.println("Connecting to Server");
              Socket skt = new Socket(HOST, PORT);
              //Create a file input stream and a buffered input stream.
              FileInputStream fis = new FileInputStream(filename);
              BufferedInputStream in = new BufferedInputStream(fis);
              BufferedOutputStream out = new BufferedOutputStream( skt.getOutputStream() );
              //Read, and write the file to the socket
              int i;
              System.out.println("Connected to Server");
              System.out.println("Sending data...\n");
              while ((i = in.read()) != -1)
                   out.write(i);
                   //System.out.println(i);
              System.out.println("Transfer complete.");
              //Close the socket and the file
              out.flush();
              out.close();
              in.close();
              skt.close();
              return true;
         catch( Exception e )
                   send(file.getAbsolutePath());
              return false;
    }

    I am making a server printer where all the system can take print out from the Printer installed on the server
    i am not able to send file from the client to the Server. I am Attaching the code Please Help me it is my college project.
    Server.java*
    import java.io.*;
    import java.lang.*;
    import java.net.*;
    import java.util.*;
    import java.io.File;
    class Server
         static final int PORT      = 26548; //Server Listening port
         static String path;
         public static void main(String args[])
              System.out.println("Starting Server");
              receive();
         public static void receive()
              while ( true )
                   try
                        //Create a socket
                        ServerSocket srvr = new ServerSocket(PORT);
                        Socket skt = srvr.accept();
                        String clientname= skt.getInetAddress().getHostAddress();
                        int clientport=skt.getPort();
                        long time = System.currentTimeMillis();
                        path= "C:\\Ankit Gupta\\Programs\\"+clientname+"\\"+time+" test.pdf";
                        System.out.println("File Recieved from : "+clientname+" : "+clientport);
                        //HttpServletRequest req;
                        //String remoteHost = req.getRemoteHost();
                        //String adr = getRemoteUser();
                        FileOutputStream fos = new FileOutputStream(path);
                        BufferedOutputStream out = new BufferedOutputStream(fos);
                        BufferedInputStream in = new BufferedInputStream( skt.getInputStream() );
                        //Read, and write the file to the socket
                        int i;
                        System.out.println("Receiving data...");
                        while ((i = in.read()) != -1)
                             out.write(i);
                        out.flush();
                        in.close();
                        out.close();
                        skt.close();
                        srvr.close();
                        System.out.println("Transfer complete.");
                        printfile();
                   catch(Exception e)
                        System.out.print("Error! It didn't work! " + e + "\n");
                   try
                        Thread.sleep(1000);
                   catch (InterruptedException ie)
                        System.err.println("Interrupted");
              } //end infinite while loop
         public static void printfile()
              delete();
         public static void delete()
              try
                   Thread.sleep(5000);
              catch (InterruptedException ie)
                   System.err.println("Interrupted");
              System.out.println("Deleting file");
              File f = new File(path);
             // Make sure the file or directory exists and isn't write protected
              if (!f.exists())
                   throw new IllegalArgumentException("Delete: no such file or directory: " + path);
             if (!f.canWrite())
                   throw new IllegalArgumentException("Delete: write protected: "+ path);
              // If it is a directory, make sure it is empty
             if (f.isDirectory())
                   String[] files = f.list();
                   if (files.length > 0)
                   throw new IllegalArgumentException("Delete: directory not empty: " + path);
             // Attempt to delete it
              boolean success = f.delete();
              if (!success)
                   throw new IllegalArgumentException("Delete: deletion failed");
    Client.java_
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.io.*;
    import java.util.*;
    import java.net.*;
    public class Client extends JFrame {
    static final int PORT = 26548; //Server Listening Port
    static File file;
    static final String HOST = "10.35.9.152";//Server Address     
    JTextField   m_fileNameTF  = new JTextField(25);
    JFileChooser m_fileChooser = new JFileChooser();
    Client() {
       m_fileNameTF.setEditable(false);
         JButton openButton = new JButton("Open");
         openButton.addActionListener(new OpenAction());
         JPanel content = new JPanel();
         content.setLayout(new FlowLayout());
         content.add(openButton);
      content.add(m_fileNameTF);
         this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         this.setContentPane(content);
         this.setSize(400,200);
    class OpenAction implements ActionListener {
         public void actionPerformed(ActionEvent ae) {
              int retval = m_fileChooser.showOpenDialog(Client.this);
              if (retval == JFileChooser.APPROVE_OPTION) {
                   file = m_fileChooser.getSelectedFile();
                 m_fileNameTF.setText(file.getAbsolutePath());
                   send(file.getAbsolutePath());
    public static void main(String[] args) {
         JFrame window = new Client();
         window.setVisible(true);
         public static boolean send( String filename )
         try
              System.out.println("Connecting to Server");
              Socket skt = new Socket(HOST, PORT);
              //Create a file input stream and a buffered input stream.
              FileInputStream fis = new FileInputStream(filename);
              BufferedInputStream in = new BufferedInputStream(fis);
              BufferedOutputStream out = new BufferedOutputStream( skt.getOutputStream() );
              //Read, and write the file to the socket
              int i;
              System.out.println("Connected to Server");
              System.out.println("Sending data...\n");
              while ((i = in.read()) != -1)
                   out.write(i);
                   //System.out.println(i);
              System.out.println("Transfer complete.");
              //Close the socket and the file
              out.flush();
              out.close();
              in.close();
              skt.close();
              return true;
         catch( Exception e )
                   send(file.getAbsolutePath());
              return false;
    }

  • How to synchronize File Manager Server when I install Agile on distributed?

    The Environment I install is : two Agile Server , two File manager Server ,one Web Proxy Server, one DB Server .
    The Agile version I install is Agile 9.3.1 for Linux ,the Middleware is weblogic 10.3.2 .
    Now I finish install two Agile Server ,and successful make two server compose a cluster.
    Now I will install two File manager Server ,I want to ask what's the method let me synchronize two file manager Server ?
    Does the File manager has this mechanism to let the file keep synchronize on two file manager server?
    I find a PDF name "Agile PLM Capacity Planning Guid" V 9.3.1 ,it says there are two software can synchronize file manager server , is XXCOPY and RoboCopy, but the two softwares only support Windows . Is there a software support synchronize file manager server on Linux ?
    帖子经 954937编辑过

    Hi I believe you have the wrong forum.
    This forum is for the Agile PLM for Process product suite, not for the Agile A9 suite. For Agile A9 or Primavera questions, you can use Oracle Support, Support Communities, Yahoo Groups for Agile API or WRAU.
    This forum is for Agile PLM for Process, which is part of the same Agile family but a different product.
    Thanks.

  • How to save file on server folder

    hi
    i was trying to save file in my specify folder path.
    but it cann't save on than location.
    if i will not specify path then it directly save file on "c:program files\tomcat5.7\bin\mytextfile.txt"
    if i will specify perfect path "c://systemfile//mytextfile.txt"
    it saves on that location.
    if i will define path as ".//www//systemfile//mytextfile.txt"
    "//www//systemfile//mytextfile.txt"
    "//systemfile//mytextfile.txt"
    ".//mytextfile.txt" it cann't save file on location

    i know how to upload file .
    i need to save file on my web folder " /www/file/ xxxx.txt"
    how i will save it .over ther in my program i will specify location "c:/Program file/file/xxxxxx.txt"

  • How to copy file from server to another machine in network through JSP

    Hello!
    any body can solve my problem.
    i m working in JSP. i want to copy a file from server on which JSP engine is running to another computer in the same network.
    i used Java File Object to copy file from one machine to another in network. and its working fine on network. but the problem is when i used the same code in web page there is exception which is Access is Denied. what i should do now.
    i m writing the code i m using in my JSP page
    String fileToCopy = "C:/oracle/Apache/Apache/htdocs/FAO/FAO_MiddleFrame.jsp";
         String destinationDir = "\\\\af09\\c";
    File source = new File(fileToCopy);
    String fileName1 = source.getName();
    if ((!destinationDir.endsWith("\\")) && (!destinationDir.endsWith("/"))) {
    destinationDir = destinationDir + "\\";
    File destination = new File(destinationDir + fileName1);
    if (!destination.exists()) {
    if (!destination.createNewFile()) {
    //throw new IOException("Unable to create file. May be you don't have permissions.");
    byte[] buffer = new byte[1024];
    FileInputStream in = new FileInputStream(source);
    FileOutputStream outStream = new FileOutputStream(destination);
    int bytesRead = 0;
    while ((bytesRead = in.read(buffer)) != -1) {
    outStream.write(buffer, 0, bytesRead);
    out.println("File copied successfully ....");
    plz reply me as soon as possible.
    i will be very thankful
    Saad

    Thats the way it works. Cause servlet contaner doesnot allow other machines in the network to access other than machine which it came from as in case of applets. What you can do is if the other machine is also based on webserver or app server .. you can upload the file as it gets to that page do the process.
    I would like to hear more on my comments..
    Suggestions ??
    Ban

  • 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 read files on server from a java program?

    Hello,
    I am fairly new to JSP programming. I have an issue with reading files. I am trying to call method of a normal java file from a jsp program. The method I am trying to call does some IO operation on Files. I have the files in the same directory as my class files on server that is in WEB-INF/classes folder. In my java program, I am giving just the file name to open because the files and the classes are in the same directory. But this is not working.
    What exactly should I do to read a file from a java program, that is running on the server?
    Any help is appreciated.
    Thanks,
    Krishna

    String realFilePath = application.getRealPath("/WEB-INF/myFile.txt");
    File fileToOpen = new File(realFilePath);
    out.println(fileToOpen.getAbsolutePath() + ": exists? " + fileToOpen.exists());in this case "application" is a reference to the ServletContext.
    It is an implicit variable in a JSP. In a servlet:
    ServletContext application = getServletConfig().getServletContext();

  • How to view file from vss using java Commandline

    Hi To ALL,
    I wanted to view a file from vss through java code.
    By using the folowing code,i could able to get vss file in to local folder.
    Runtime.getRuntime().exec
    ("cmd /c ss Get $/Mywork/Myfile.java -GLC:/New");
    But i wanted to view file from vss using java code.
    any one please help me..
    Thanks in advance.........

    As always, Google is your friend.
    Follow the bouncing link.
    http://www.google.com/search?hl=en&q=VisualSourceSafe+%2B+Java+API
    PS.

Maybe you are looking for

  • How do i transfer my old Apple Mail to a new iMac

    I have a new iMac running OS 10.10.1 and Apple Mail 8.1 and an old Mac Pro running OS 10.7.5 and Apple Mail 5.3.  I have a LOT of unwanted apps and other material on my MacPro which I don't want to transfer so I can't use migration methods that just

  • Exception Handling for many bean objects of a container class in a JSP page

    Hello, I have on container bean class. In this container class, there are several others class objects and the getter methods to get these objects out to the JSP pages. I have one JSP page which will use different objects in the container class objec

  • Share microsoft office documents not saving on all users

    Set up new user account for my wife shared my "desktop" where regular microsoft excel and word documents we use are saved Wife's account can access documents and save, but when testing and i try on my user, the file alterations have not been done. I

  • RAID arrays and Windows

    Not sure where to post this one.  You have been very helpful before so I'll try again. The machine is the Media Centre in my signature. Installed two new Maxtor SATA drives, set up as RAID 0, clean install of XP MCE. Boots on the RAID array.  Not a s

  • Attachment limit

    I was wondering how you increase you attachment limit in Mail. I have a .Mac account and I thought it had something to do with that but now I am confused. I hate having to send more than one e-mail to friends to send them multiple attachments. I gues