Saving the output of java programs in files

How I do save the output of a program to a MS - DOS file ?

import java.io.*;
use FileOutputStream /BufferedOutputStream class.....
read tutorials or books about JAVA on these technology
U can find many examples in this site too

Similar Messages

  • Saving the output of a .sql file in .csv format

    Hi,
    I am saving the output of a .sql file in .csv format. But the problem is , the record of few columns have "new line" character in it, so when it is getting saved in .csv format, those records are coming in multiple rows, but they should come in one single row in single block. Please advise how to overcome this problem.
    Regards,
    Niraj

    Hi Guys,
    I guess, there is a misunderstanding.
    He is talking about the issue caused as a result of the data containing a "CRLF" ( Carriage return Line feed ) .
    That is mainly a data issue.
    The query i presume, must be right.
    I guess you should be able to fix it using some string functions.
    Some thing similar to this
    CREATE TABLE ASH (NAME VARCHAR2(10))
    SELECT REPLACE(NAME, CHR(13)||CHR(10), 'ISH') FROM ASH;
    SELECT REPLACE(NAME, CHR(10), 'ISH') FROM ASH;
    SELECT REPLACE(NAME, CHR(13), 'ISH') FROM ASH;
    depending on the type of new line whether it is CR or LF. or CRLF.
    Regards
    Ashish/-

  • Passing the output to another program

    Passing the output to another program
    The problem I have that I don�t know how to pass the results of my java Program ( as parameter) to another application!
    I have a class �A.class� should send result �VAR_result� to application �B.application�
    Now I am using it like this: System.out (VAR_result) >> B.application
    But it could not be the right way at least because I cant make any other System.out as debug now.
    My Question please: to pass a parameter to a java is clear: A.class ( var ..)
    But how to take a parameter from a class, to use it in another Applicatin ( script )?
    Thanks a lot

    slackware2007 wrote:
    Passing the output to another program
    The problem I have that I don’t know how to pass the results of my java Program ( as parameter) to another application!
    I have a class “A.class” should send result “VAR_result” to application “B.application”
    Now I am using it like this: System.out (VAR_result) >> B.application
    But it could not be the right way at least because I cant make any other System.out as debug now.Then move your debug to System.err and use System.out as it should be used and pipe stdout to the stdin of the other application..

  • Update LIKP table while saving the output type in VT02N transaction

    Hi All,
    I have a requirement where i have to update Delivery Priority(LPRIO) field in LIKP table while saving the output type in VT02N transaction. I am not able to use the BAPI "BAPI_OUTB_DELIVERY_CHANGE" or FM "WS_DELIVERY_UPDATE" because, when we save the output type the programs that are configured in NACE are triggered in update mode and hence i will get a roll back error.
    Let me know other ways of updating the table at the time of saving output type for shipment transaction VT02N.

    This could be a result of one of the following reasons:
    1: Incorrect smart form/routine assigned in the output configuration (NACE)
    2: Serial number range of the delivery expired
    3: The default settings of the user (SU01) processing the delivery is missing the default printer name.
    Hope this is helpful
    Manish

  • Creating a Mavericks USB boot drive after the horse has bolted.  Can I create a bootable USB drive from my iMac after installing Mavericks without saving the Install OS X Mavericks.app file?  Do I need to re- download the whole 5.29 Gb again?

    Creating a Mavericks USB boot drive after the horse has bolted.  Can I create a bootable USB drive from my iMac after installing Mavericks without saving the Install OS X Mavericks.app file?  Do I need to re- download the whole 5.29 Gb from the App Store again?  My problem is my 4Gb/month allowance on a 12 month contract.  I cannot purchase a data block from my ISP and although my speed is theoretically slowed to 64k after reaching my 4Gb, it actually ceases to download in reality.

    HI tasclix, it depends what you mean by an OS X boot drive.
    If you want a recovery disk from which you can reinstall (by re-downloading) or recover from a time machine backup, then nbar is correct.
    If, however, you want to boot and run the OS X installer from the USB drive (so that you don't need to download again), then you will need a copy of "Install OS X  Mavericks.app"; see this article:
    http://support.apple.com/kb/HT5856
    Before downloading again, search your system to see if the installer is still there - it's usually in the /Applications folder unless it has been deleted, but check your whole system for it anyway, you never know, you might still have it somewhere.
    Message was edited by: SilverSkyRat

  • How to capture the output of another program into a File/String

    I needed to capture the output of a dos program in an String/file I tried doing Runtime.getRuntime.exec("ipconfig /all >tmp.txt");
    but still I am unable to capture the output frm the program which I would like to capture in a file or String.Can anyone help

    When you use the Runtime.exec() method, it returns a Process object, that process object has access to the streams; stdout, stdin, and stderr of the application you just executed. what you'll want to monitor is the stdout or stderr streams using the
    p.getInputStream() or p.getErrorStream(), where p = the process object returned via the Runtime.exe() method.

  • Adding numbers in a file a and saving the output in another file.!

    can any one pls tell me how to add numbers from a textfile and save the output in another textfile. i'm new with java so pls help out..

    Hi Friend,
    your statement is not clear, it's bit confuse
    this is my unserstanding,
    you want to open a file and read the values then add numbers,
    latter save the sum in a new file.let me know if this is the thing, I can help u
    with Cheers
    Prasanna

  • How Can we stop the execution of java program which contain infinite loop

    Dear All,
    I create one .bat file which which execute the simple java program
    I write one java program which execute above .bat file using instance of Runtime Class of java
    It's work fine if java program which is executed by .bat file is simple(Which has normal termination)
    But if that program contain inifinte loop then that file will goes on executing untill I close it manually
    So i want a solution in java which close that bat file (command window ) which is in running condtion
    If there any solution please replay me
    I try to close that .bat file using destroy() ,stop() method of Process and Runtime , Thread Class
    but it did not give me correct output
    .bat file still running !!!!!!!!!
    Thanks in advance

    Why not use javaw.exe to make the app run so you don't need the dos window (which is presumably what you are actually talking about when you say bat file).

  • How can i save the output  of  report into  a file,.

    Hi friends,
                 i was create a executable program .. it was executing fine.. imagine.. my program is just fetching the data from  LFA1  table based on some conditions.. every thing is fine.. and i'm getting the output also..
    but i want to save this output in a separate file.. that means.. what can i do.. my program is executing background... so, i want to save this out put in a file... so, can any one plz provide me the coding steps...
    for example here i'm giving the  my program code.. so, now where can i add the new coding.. and what can  i add ...
    data:begin of  table itab occurs 0,
            lifnr  type  lifnr,
            name1 type  name1,
            end of itab.
    select lifnr  name1  from lfa1  into table  itab .
    loop at itab.
    write:/  itab-lifnr , itab-name1,
    endloop.
    i dont know coding.. I'm learning ABAP... so, can you plz provide the exact coding..for storing these data into separate file from spool..
    help ful answers will be rewarded
    Thanks
    Babu

    Hi  Santhosh,  and  Atish,
         Thanks  for ur responces... i was mention already in my question itself.. that my program is executing  in background.. so,  every day at  6 am it will execute.. but i want to see the result...
    for that what can i do..
    regards
    Babu

  • Re: how to redirect the output from studio to a file

    the thing is i have large amount of output(crapy uni project), it's kind of hard to read them in IDE output window, and i am too lazy to use fwrite to a file. in terminal it's just "output > filename", but doesn't work in IDE. anyone knows?

    The Arguments property will take a "> file".
    This property can be set in several places.
    In studio 10/11:
    - Debug->LoadProgram
    - Debug->LoadRecent->EditLoadCommandList
    After you've loaded a program...
    - Debug->DbxConfigure
    In studio 12:
    Project (ctx menu)->Properties->Running(Category)

  • Some examples in saving the output into memory

    After running the class file i would like to save the results into memory, and then update the results in memory every time the program runs including the number of times it checked whatever it is going to check with the result of that checking. Then saving the results into a .txt file every time the program goes to sleep for an hour, as it has while(ture) loop.
    Will storing data in a variable save it into memory?? (example if u can please)
    I will be gratefull if you could tell/show me how to to save the results into memory and then update these results (i will need examples please). As having the program in a while(ture) loop and saving the result into a .txt file has been done.
    Thanks a lot in advance.

    i am sorry if i did not make myself clear, but i dont know how to do that, if there r any examples so I could understand it, i am sorry again. What i am trying to do is to store some information to memory and then update and retrieve these information later on and write it into a file, and do the same every hour.
    I am sorry for not understanding it and for not making anyone to understand it.

  • Reading the output from another program.

    I haven't used Java in a good long while so I need someone to point me in the right direction. I have a C program that I call from a command line (windoze boxen) and it spits out some neat data. I can call it from inside a Java program, but how do I then read the output from the calling Java program? I'd just alter the C program, but I lost the source.

    This article explains how to correctly execute another program from your
    Java program, and read its output:
    http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html

  • How to find directory java program .jar file is in?

    I have a Java program that needs to save some configuration and data files in the same directory as the .jar file that contains the program.
    If the user launches the app from that directory, it's easy.
    The problem is when they do something like "java -jar /dir1/dir2/program.jar".
    When they do that, HOW can I find the directory the .jar file is in - from within the program?

    CasaDelGato wrote:
    I have a Java program that needs to save some configuration and data files in the same directory as the .jar file that contains the program.
    If the user launches the app from that directory, it's easy.
    The problem is when they do something like "java -jar /dir1/dir2/program.jar".
    When they do that, HOW can I find the directory the .jar file is in - from within the program?There is an obscure way that basically consists of the following.
    1. Get the class loader of the class (obviously one in the jar)
    2. Find the 'resource' of that.
    3. Resolve that to a path
    4. Make it absolute if not already.
    5. Extract the directory part.
    2 and 3 are always the hard ones (conceptually and figuring out from the javadocs). There are examples somewhere on the forum.

  • How to approve the step from java program ?

    Hi all,
    I want to approve a step from java program.
    I call the store function "wf_notification.setattrtext" & "wf_notification.respond".
    It's not work.
    The notification's status become to 'CLOSE', but PO_REQUISITION_HEADERS_ALL.AUTHORIZATION_STATUS is 'IN PROCESS'.
    And I try to approve the flow from oracle web gui and it's OK !
    The notification's status become to 'CLOSE', but PO_REQUISITION_HEADERS_ALL.AUTHORIZATION_STATUS is 'APPROVED'.
    The java program as follows, and '1099999' is notification id.
    Can anyone please please please help me?
    Thanks, all.
    Gavin
    ===================================================================================================
    import java.util.*;
    import java.io.*;
    import java.sql.*;
    import java.util.*;
    import javax.rmi.*;
    import javax.naming.*;
    import javax.sql.*;
    import java.sql.*;
    public class CommitPR
    public static void main(String[] aArgs) throws Exception
    String driver = "oracle.jdbc.driver.OracleDriver";
    String url = "jdbc:oracle:thin:@10.1.1.1:1521:ORA";
    String user = "user";
    String password = "password";
    Class.forName(driver).newInstance();
    String sql;
    Connection conn = null;
    Statement callStmt;
    conn = DriverManager.getConnection(url, user, password);
    conn.setAutoCommit(true);
    callStmt = conn.createStatement();
    sql = "{ CALL WF_NOTIFICATION.SETATTRTEXT ('1099999','RESULT','APPROVE') }";
    System.out.println("sql=" + sql);
    callStmt.execute(sql);
    sql = "{ CALL WF_NOTIFICATION.RESPOND ('1099999','ARRPOVED','EIP_ADMIN') }";
    System.out.println("sql=" + sql);
    callStmt.execute(sql);
    callStmt.close();
    conn.close();
    ===================================================================================================

    Hi,
    the JavaAPI didn't work with the xdo-Files. But you can create a proxy stub for the Web Service API of BI Publisher which uses the xdo's in the repository.
    regards
    Rainer

  • Saving the output from a JSP request

    I have developed a decision support web site that amongst other things generates a "report" page. Now my client would like to add the ability for users of the site to have that report emailed out to them.
    Sending the email obviously isn't a problem, but getting the content into it is. I really don't want to have to duplicate all the JSP code from the report page (there's a lot, including calls to beans etc), and reformat the entire thing with hundreds of out.write("<table>") like statements, or nasty plain-text formatted equivalents.
    So...is there a way to "save" the output generated by the server before it gets sent back to the user - ideally to a local file that I can then just dump straight into the email message. I can't just call the page (internally on the server) to see its output, as it's user-specific and uses a lot of session-related information.
    Cheers for any advice...
    Iain

    It's actually possible to do what I want to do by getting the server to call the page internally (I didn't think it was).
    A simple URLConnection to the appropriate page with the jessionid appended gives me back the page as the user would see it. I can then just stream the response from that to file/email/whatever.
    When the user clicks on their "email" link, I just call a jsp file (or a servlet) with the following code:
         URLConnection uc;
            BufferedInputStream fin;
         BufferedOutputStream fout;
         String location = "http://localhost:8080/blah/report.jsp"
              + ";jsessionid=" + session.getId();
         String filename = "C:\\output.html";
         try
              uc = new URL(location).openConnection();
              fin  = new BufferedInputStream(uc.getInputStream());
              fout = new BufferedOutputStream(new FileOutputStream(filename));
              int byteRead = fin.read();
              while (byteRead != -1)
                   fout.write(byteRead);
                   byteRead = fin.read();
              fout.close();
              fin.close();
         catch (Exception e) {}Now all I have to do is go learn how to write multipart emails using JavaMail...

Maybe you are looking for