How to read file at server? URGENT

hi,
I got stucked to read a file which is at the server, i used this code :
java.io.FileInputStream fis;
String ipaddr="";
int ch;
try
     fis=new java.io.FileInputStream("server.ini");
     while((ch=fis.read())!=-1)
          ipaddr=ipaddr+(char)ch;
     ipaddr=ipaddr.trim();
     System.out.println(ipaddr);
}catch(Exception e){System.out.println(e);}
I'm getting a FileNotFound exception, where i went wrong.

Hello hikiran.
The server.ini file should reside in your application working directory. If it's not there, then the JVM won't find it. Otherwise you could specify an absolute path to the file, but your application will be less portable. Another choice you have is to define an environment variable which tells your app where the server.ini file resides, with the command
  java -Dmyapp.ServerIni=C\SomeFolder\server.ini myappThen you retrieve the pathname with:
   String path = System.getProperty("myapp.ServerIni");This way your app does not depend on the filesystem on which it's been installed to, because changing the command line that starts your app will be enough to have it working.
Note: if you have to read a text file consider using the java.io.BufferedReader class which lets you to get rid of the different text file formats problems you find when you move to a unix like platform (newline characters are different).

Similar Messages

  • 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 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 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();

  • [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 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 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

  • HOW to read file using ftp???

    Hi to all,
    I have problem with reading file using ftp connection, i want to read only 1024 bytes for one time, and i have
    next code wich read this:
    byte buffer[] = new byte[1024];
    while( (readCount = input.read(buffer)) > 0) {
    bos.write(buffer, 0, readCount);
    but I dont know how to put all read data in one byte[] if i dont know length of file.
    I can't do some like: byte file[] = new file[1000000];
    Thanks for all sugestions!

          * Download a file from a FTP server. A FTP URL is generated with the following syntax:
         * <code>ftp://user:password@host:port/filePath;type=i</code>.
          * @param ftpServer FTP server address (incl. optional port ':portNumber').
          * @param user Optional user name to login.
          * @param pwd Optional password for <i>user</i>.
          * @param fileName Name of file to download (with optional preceeding relative path, e.g. one/two/three.txt).
          * @param destination Destination file to save.
         * @throws MalformedURLException, IOException on error.
         public void download(String ftpServer, String user, String pwd, String fileName, File destination) throws MalformedURLException, IOException {
            if (ftpServer != null && fileName != null && destination != null) {
                StringBuffer sb = new StringBuffer("ftp://");
                if (user != null && pwd != null) { //need authentication?
                    sb.append(user);
                    sb.append(':');
                    sb.append(pwd);
                    sb.append('@');
                }//else: anonymous access
                sb.append(ftpServer);
                sb.append('/');
                sb.append(fileName);
                sb.append(";type=i"); //a=ASCII mode, i=image (binary) mode, d= file directory listing
                BufferedInputStream bis = null;
                BufferedOutputStream bos = null;
                try {
                    URL url = new URL(sb.toString());
                    URLConnection urlc = url.openConnection();
                    bis = new BufferedInputStream(urlc.getInputStream());
                    bos = new BufferedOutputStream(new FileOutputStream(destination.getName()));
                    int i;
                    while ((i = bis.read()) != -1) { //read next byte until end of stream
                        bos.write(i);
                    }//next byte
                } finally {
                    if (bis != null) try { bis.close(); } catch (IOException ioe) { /* ignore*/ }
                    if (bos != null) try { bos.close(); } catch (IOException ioe) { /* ignore*/ }
            }//else: input unavailable
        }//download()If you don't want to strore the data into a file, use ByteArrayOutputStream instead of a FileOutputStream.

  • How to read file in flex ?.

    can anyone of you help me to know how to read a file in local
    disk with flex.

    You cannot! Flex is flash player based player meant to work
    with browsers and browsers are not allowed to access the local
    disks.
    You can either read/write file on the server. or consider
    using AIR.
    ATTA

  • 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 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 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

  • 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

Maybe you are looking for

  • No loops in '08

    This may be a dumb question but here goes anyway. I open Garageband on my new MacBook and there are no loops in it. I click on a loop and a dialog box pops saying the selected loop is not currently installed on my computer and would i like to install

  • Bank account numbers for the same vendor in two company codes

    Hi guys, just one question.¡ If I have the same vendor’s account number created in two different company codes, Is it possible to have different bank account numbers for each company code even though it is the same vendor number? If its possible, wha

  • Changing the setting from PDF file to a  JPEG file.

    Is there a way I can change the scan setting on my printer. It is a HP Deskjet F4480. I want to change the setting from PDF file to a JPEG file. I want to scan them so I can see them on my screen saver.

  • Canon 5D Mark III Raw Files Not Viewable in Finder for Snow Leopard 10.6.8

    System specs: Computer: Mid 2008 Mac Pro - Dual Quad Core OS: OS X 10.6.8 (includes the most recent Digital Camera Raw Updates) Camera: Canon 5D Mark III Problem: Finder can not preview the thumbnails from this camera.  While not that big of a deal (

  • Duplicate Inbound Deliveries

    Hi, We are recently creating Inbound Deliveries automatically from the outbound deliveries postings using SPED output type, on stock transfer orders. Unfortunately, users in the receiving plant still use MIGO (against the outbound delivery) for inbou