GetInputStream from Process in Unix

child=rt.exec("sh test.sh");
DataInputStream disOutput = new DataInputStream(new BufferedInputStream(child.getInputStream()));
while ((temp = disOutput.readLine()) != null)
System.out.println("Ouput:"+ temp);
This code works in NT, but it doesn't in unix. I don't understand why, I want to read the InputStream while they are being printed, in NT it prints, but in UNIX nothing gets printed, however, the test.sh still executes.
Why and how to solve this problem? Thanx a bunch
Edmund

DataInputStream seems an odd choice for reading streams of text. An InputStreamReader wrapped in a BufferedReader would make more sense. Might not solve your current problem, but why not try it?

Similar Messages

  • Runtime.exec("ftp") , but cann't read from Process.getInputStream()

    first, Runtime.exec("ftp")
    then I read from Process.getInputStream()
    but I get nohting. why ?
    I think I should read a prompt string "ftp>"
    and, Process.getInputStream() return a BufferedInputStream, how can I get a non-buffered InputStream from it ?

    Disregarding your actual question, I'll take a stab at the REAL issue.
    If you're going to script an FTP session, why not use ftp -s:<filename>?

  • Write blob data from database to unix server

    Hi all,
    I need to send the attachment file into the mail. I have a header form in which I have implemented Download/Upload functionality using Apex user guide. When ever a user fill all the entries and submit the form then some field information along with attachment I need to send to the user.
    I mean when ever user hit the submit button it should take blob data from my custom table tmp_downlod_files and send to the user as an attachment.
    I have searched the post and got lot information but not able to get succeed.
    I have implemented java stored procedure for sending automatic mail when user is submitting the form but what I need is to take blob content from database and send as an attachment.
    1: So I need to write blob content from custom table to unix server in some location and from there I need to attach that file.
    2: the java store which I have implemented for sending automatic mail is working and one argument is attachment which I am passing null for now. So mail is working how to write the file from database to unix server and send as an attachment.
    What I did for writing file from database to unix server:
    1:
    CREATE OR REPLACE PROCEDURE trx_blob_to_file (l_header_id IN NUMBER)
    IS
    BEGIN
    FOR rec_picture IN (SELECT ID
    FROM TMP.tpx_download_files
    WHERE header_id = l_header_id
    AND mime_type LIKE ('image' || '%'))
    LOOP
    DECLARE
    l_out_file UTL_FILE.file_type;
    l_buffer RAW (32767);
    l_amount BINARY_INTEGER := 32767;
    l_pos INTEGER := 1;
    l_blob_len INTEGER;
    p_data BLOB;
    file_name VARCHAR2 (256);
    BEGIN
    SELECT blob_content, filename
    INTO p_data, file_name
    FROM tpx_download_files
    WHERE ID = rec_picture.ID;
    l_blob_len := DBMS_LOB.getlength (p_data);
    l_out_file :=
    UTL_FILE.fopen ('/home/oracle/interfaces/out/upld',
    file_name,
    'wb',
    32767
    WHILE l_pos < l_blob_len
    LOOP
    DBMS_LOB.READ (p_data, l_amount, l_pos, l_buffer);
    IF l_buffer IS NOT NULL
    THEN
    UTL_FILE.put_raw (l_out_file, l_buffer, TRUE);
    END IF;
    l_pos := l_pos + l_amount;
    END LOOP;
    UTL_FILE.fclose (l_out_file);
    EXCEPTION
    WHEN OTHERS
    THEN
    IF UTL_FILE.is_open (l_out_file)
    THEN
    UTL_FILE.fclose (l_out_file);
    END IF;
    END;
    END LOOP;
    END;
    2: I have written a PL/SQL process and calling the above procedure on SUBMIT:
    DECLARE
    l_header_id NUMBER;
    l_filename VARCHAR2 (200);
    BEGIN
    SELECT header_id, filename
    INTO l_header_id, l_filename
    FROM tpx_download_files
    WHERE header_id = :p35_sr_header_id;
    trx_blob_to_file (l_header_id);
    END;
    But it is not writing the file from database to unix server.
    If I can get how to make working to write file from database to unix server then I will hopefully can send an attachment.
    3; I have given
    GRANT EXECUTE ON TPX_BLOB_TO_FILE TO PUBLIC.
    And
    GRANT EXECUTE ON UTL_FILE TO PUBLIC.
    Where I am doing wroung can anyone guide me or any other approach is appreciated.
    I am already late so I need soon. Please help.

    Hi all,
    I need to send the attachment file into the mail. I have a header form in which I have implemented Download/Upload functionality using Apex user guide. When ever a user fill all the entries and submit the form then some field information along with attachment I need to send to the user.
    I mean when ever user hit the submit button it should take blob data from my custom table tmp_downlod_files and send to the user as an attachment.
    I have searched the post and got lot information but not able to get succeed.
    I have implemented java stored procedure for sending automatic mail when user is submitting the form but what I need is to take blob content from database and send as an attachment.
    1: So I need to write blob content from custom table to unix server in some location and from there I need to attach that file.
    2: the java store which I have implemented for sending automatic mail is working and one argument is attachment which I am passing null for now. So mail is working how to write the file from database to unix server and send as an attachment.
    What I did for writing file from database to unix server:
    1:
    CREATE OR REPLACE PROCEDURE trx_blob_to_file (l_header_id IN NUMBER)
    IS
    BEGIN
    FOR rec_picture IN (SELECT ID
    FROM TMP.tpx_download_files
    WHERE header_id = l_header_id
    AND mime_type LIKE ('image' || '%'))
    LOOP
    DECLARE
    l_out_file UTL_FILE.file_type;
    l_buffer RAW (32767);
    l_amount BINARY_INTEGER := 32767;
    l_pos INTEGER := 1;
    l_blob_len INTEGER;
    p_data BLOB;
    file_name VARCHAR2 (256);
    BEGIN
    SELECT blob_content, filename
    INTO p_data, file_name
    FROM tpx_download_files
    WHERE ID = rec_picture.ID;
    l_blob_len := DBMS_LOB.getlength (p_data);
    l_out_file :=
    UTL_FILE.fopen ('/home/oracle/interfaces/out/upld',
    file_name,
    'wb',
    32767
    WHILE l_pos < l_blob_len
    LOOP
    DBMS_LOB.READ (p_data, l_amount, l_pos, l_buffer);
    IF l_buffer IS NOT NULL
    THEN
    UTL_FILE.put_raw (l_out_file, l_buffer, TRUE);
    END IF;
    l_pos := l_pos + l_amount;
    END LOOP;
    UTL_FILE.fclose (l_out_file);
    EXCEPTION
    WHEN OTHERS
    THEN
    IF UTL_FILE.is_open (l_out_file)
    THEN
    UTL_FILE.fclose (l_out_file);
    END IF;
    END;
    END LOOP;
    END;
    2: I have written a PL/SQL process and calling the above procedure on SUBMIT:
    DECLARE
    l_header_id NUMBER;
    l_filename VARCHAR2 (200);
    BEGIN
    SELECT header_id, filename
    INTO l_header_id, l_filename
    FROM tpx_download_files
    WHERE header_id = :p35_sr_header_id;
    trx_blob_to_file (l_header_id);
    END;
    But it is not writing the file from database to unix server.
    If I can get how to make working to write file from database to unix server then I will hopefully can send an attachment.
    3; I have given
    GRANT EXECUTE ON TPX_BLOB_TO_FILE TO PUBLIC.
    And
    GRANT EXECUTE ON UTL_FILE TO PUBLIC.
    Where I am doing wroung can anyone guide me or any other approach is appreciated.
    I am already late so I need soon. Please help.

  • Processes in UNIX

    Hi guys.
    I'm trying to execute a process in Compaq UNIX Tru64, but I can't do it!
    The code I use is the following:
    import java.io.*;
    public class RunProcess {
    public RunProcess(String[] args) {
    if (args.length == 0) {
    System.out.println("You missed command");
    System.exit(0);
    try {
    Runtime rt = Runtime.getRuntime();
    Process p = rt.exec(args);
    int i = Integer.MIN_VALUE;
    while ((i = p.waitFor()) != 0) {
    System.out.println("waiting...");
    System.out.println("Finish" + p.exitValue());
    catch (Exception ex) {
    ex.printStackTrace();
    public static void main(String[] args) {
    new RunProcess(args);
    If I run this code in Windows, for instance using:
    java RunProcess WinWord MyDocument.doc
    I've no problem: the MS-Word document appears on my screen and the Java program loop within while until I close the MS-Word document. After that the Java program prints "Finish" and the session in stopped.
    If I trying to execute another program (not java!!!!!!) on a UNIX PC using the same RunProcess class, the Java program always loop within while (it continuously prints "waiting...") and it never stops.
    Anyone of you could explain such different behaviour from Windows to UNIX?
    Thanx.

    You should NOT loop in waitFor! It is sufficient to call it only once!
    public abstract int waitFor() throws InterruptedException
    Waits for the subprocess to complete. This method returns immediately if the subprocess has already terminated. If the subprocess has not yet terminated, the calling thread will be blocked until the subprocess exits.

  • Deploying froms from NT to unix

    hi
    i have created custom forms in form 6i under NT. now i want to deploy that forms to unix.
    i have created fmx file in NT and FTP(binary mode) it to unix. when i tried to open it says frm-40031 not a forms runtime files.
    will just copying fmx file from NT to unix work or i need to recompiling the fmb file again in unix.
    thanks & regds
    mahesh
    null

    The .FMB file will need re-compiling into an .FMX on the target platform. There is a command-line version of the Forms compiler, so you could write a shell script to automate the re-compilation process.
    null

  • Migrating database from windows to unix

    Can anyone, please suggest me some reading on migrating a database from windows to unix? Thanks

    Yes an export import is the most likely migration path you have. There is another option. You may install, just temporarily a 10g environment on the windows platform, then upgrade using the DBUA from 8i to 10g on the same platform. This way you will make sure you don't miss a piece of data during the migration process.
    Once your database is at the 10g platform, you may proceed with a transport tablespace from 10g win to 10g unix. Violà, your database will be on the 10g platform.
    Next, deinstall the windows temporary 10g installation.
    Notes:
    1. Make sure your 8i db is at the latest patchset available at 8i (8.1.7.4.0)
    2. Define which unix platform you are referring to. It's because of endian issues.
    ~ Madrid.

  • How to delete file from application server(Unix)

    Hi All,
    Using the below code downloading a file from application server(Unix) to client machine. I want to delete the file from application server once it is downloaded to client
    We work on Forms 11.1.1.4.0 and Oracle DB 10g. Client machine are Windows 7.
    BEGIN
      IF webutil_file_transfer.AS_to_Client
      (clientFile => Name_In('global.g_file_name')
      ,serverFile => ls_AppServer_Loc)THEN
      message('Data exported Successfully');
      ELSE
       message('File download from Application Server failed');
      END IF;
    EXCEPTION
      WHEN OTHERS THEN
      message('File download failed: '||SUBSTR(sqlerrm,1,200));
      END;
    I have search for solution on OTN. Few suggested to use HOST.
    Can any one help me how to use Host() built_in to delete the file.
    Thanks,
    Maddy

    Can any one help me how to use Host() built_in to delete the file.
    Host('/bin/rm <complete file path>');

  • Partial reversal of a goods receipt from process order

    Dear All
    Could anyone please help me with explaining how to do a partial reversal of a goods receipt from process order? If Iu2019m using trans CORS I have to cancel the entire operation, which I donu2019t want to do. If Iu2019m using MIGO and MT 102 I only reverse the goods receipts of the produced material, the corresponding components from the BoM is not reversed with MT 262 as they are if I cancel with CORS, and I donu2019t want to do a second MIGO transaction in which I cancel the components with MT 261. I have also tried to create an operation with a negative quantity, but without any success.
    Itu2019s not an option for the business to reverse the entire quantity and then perform a new goods receipt with the right quantity.

    Hi again,
    I have been trying to do the reversal with CORR but Iu2019m getting the error message u201CMixed confirmation types (time ticket/time event) are not allowedu201D, message number RU179.
    Anyone who can help me on the way?
    /WM consultant on unknown territory

  • Hello, How do I tell sql+ to spool output file from windows to Unix server?

    Hello, How do I tell sql+ to spool output file from windows to Unix server?
    I am new to SQL+ and just learned how to spool the file. But file is saved in my local windows enviroment and since it's 2GB in size...I want to spool it directly to another remote unix server.
    Pls answer in detail... I have been to most of the thread and didn't see relevant answer to above question.
    Am I suppose to develope some script which FTP the spool file directly to the server I want to
    or
    i Have to use UTL_FILE Package ?
    Thanks for reply

    You may not be able to...
    SQL*Plus can only spool to the local machine. If you have mapped a directory on the Unix server from your Windows machine, you can specify that directory in your SPOOL command.
    You could telnet to the Unix server, run SQL*Plus there, and spool the file to a local (Unix) directory.
    If the Unix server is also the Oracle database server, you could use the UTL_FILE package rather than using SQL*Plus to spool a file.
    If the Unix server is also an FTP server, you could also FTP the file from your local machine to the server.
    Of course, I would tend to re-examine a requirement to regularly generate a 2 GB text file. It seems likely that there is a better way...
    Justin

  • Why did my apple watch go from processing to preparing for shipping then back to processing? Did this happen to others? What does this mean?

    why did my apple watch go from processing to preparing for shipping then back to processing? Did this happen to others? What does this mean?

    thanks.. I'm about to... was just wondering if anyone had a similar experience and it got resolved, before I wait on the phone... thanks though..

  • Each time I try to start iTunes after it was closed, it wouldn't start. I have to go to the Task Manager delete Apple Push from processes and only after that iTunes statrs again. What is wrong?

    Each time I try to start iTunes after it was closed, it wouldn’t start. I have to go to the Task Manager delete Apple Push from processes and only after that iTunes statrs again. What is wrong

    Did you manage to get it working mine disappeared after I while I managed to download it but now my laptop/iTunes won't recognise my iPhone!

  • How can we call a task in process definition A from Process definition B

    Hi,
    Is that possible to call a task in process definition A from Process definition B?
    Thanks.

    Sure, as long as you can come up with the correct query to lookup the task key for the task you want to run.
    provIntf.addProcessTaskInstance(taskKey, processInstanceKey);
    -Kevin

  • Can we call Function Module from Process Chain?

    Hello experts,
    I have a small question.
    Can we call Function Module(SE37) from Process Chain?
    If yes can you please provide some example link?
    I m new to BI world.
    regards

    Hi,
    Create one ABAP program and call the function module from that program. Check the link to know how to call a function module from an ABAP program.
    http://help.sap.com/saphelp_wp/helpdata/en/d1/801edb454211d189710000e8322d00/content.htm
    http://help.sap.com/saphelp_wp/helpdata/en/9f/db98ef35c111d1829f0000e829fbfe/content.htm
    Then use process type "ABAP Program" in your process chain and add the program you have created. So then this program will be executed via process chain and this program will call the function module.
    Indrashis

  • Document level scripting from process workflow

    Hi all,
    is there some way to add a "document level" script from process workflow in Livecycle Workbench?
    That is, I have a script i want to add to a pdf in my process workflow. How can I do that? Is there some service/function/script I can use to do that?
    I'd really appreciate any help.
    Thanks
    Alessio

    Not that I am aware of, could be wrong though

  • Automatic Transfer Order for GR from External vendor and from Process Order

    Hi Expert
    We need to implement the logic for automatic transfer order,
    the Idea when we Receive the Goods from Vendor and while posting goods via Migo we want that the system create automatically the TO.
    the same approach to be implemented for GR from Process Order we need that the system create TO directly to the right Bin
    Your support is higly recommanded
    Olfa

    Many thanks for your support
    I made what you illustrated in your previous message for the Mvt type 501:
    There is a pop up screen which displayed asking me to create TO for Material Document
    Please find attached the related screens
    And please note that the Material Master was updated accordingly
    Please note
    Please correct me if I made a wrong step
    Regards

Maybe you are looking for

  • How can I use two database in Dataset in SSRS?

    Hi, I am using one query to generate my SSRS report. In that query I am using subquery. Now I am pulling data from multiple tales. DB used in sub query is different than the rest of the tables DB.(So total I am using 2 DB(Database)) So I see that in

  • ABAP - Logic for finding out the active employee

    Hi, I am trying to write the program where i need to set the flag "YES" to active employee for the particular time period for the particular position. For example: Row     Employee     DateTo     DateFrom          Position     FLAG 1     1     1.1.20

  • ClassNotFoundException deserializing

    I am having an strange problem: in a servlet, when I serialize and then deserialize it's session I happen to get: 1.- Serialization and Deserialization goes OK when session has no attributes; 2.- Serialization and Deserialization goes OK when session

  • PXI 2515 Bus to Dut Connection

    Hi all, I'm trying to make a connection from an SMU through the PXI 2515 to an IC pin to do a continuity test (protection diodes), I've already confirmed their presence on benchtop equipment. I'm using the "niSwitch Making Connections on a Switch" VI

  • PDF Conversion of Word document file too large

    I am going crazy trying to figure out why PDF document files I make on my Mac are so much larger (file size) than the same document converted on my Windows machine using Adobe Acrobat. I also tested the file size by having a friend use her CutePDF do