Executing a native process and getting the text output

Hi,
I have the following problem.
When I execute a native DOS process (lets say a batch file), and
expect some text output from this process I use the following code:
String command = "test.bat";
Process process = runtime.exec(command);
BufferedReader rd = new BufferedReader(new InputStreamReader(process.getInputStream()));
String s = new String();
while((s = rd.readLine())!=null) {
     out.println(s + "<br/>" );
The problem is that as long as rd.readLine() does not return null, the page does not display the result. When the process crash, sometimes nothing return.
I would like to display the output as it comes, i.e. line by line.
I have no clue on how to do that except writting the output in a text file, and reading the text file with a page that reload every x seconds.
I do not beleive this is a good solution.
Additionaly, I may have a huge output. It seems to make the process
to hang. Is there a was to fix it.
Could someone give me some hints.
Regards,
Arnaud.

I am having the same problem...did you ever solve it?

Similar Messages

  • Execute command on UNIX and get the result

    I want to write a Java program, which can execute a shell script in UNIX and get back the result. Any idea?

    Check these two tips:
    How to execute a command from code
    http://www.java-tips.org/java-se-tips/java.lang/how-to-execute-a-command-from-code.html
    How to read output from a Command execution
    http://www.java-tips.org/java-se-tips/java.lang/how-to-read-output-from-a-command-execution.html

  • How to fetch the data from databse table and get the required output

    Hi,
    I have made a project that connects CEP to database table but i m getting some problem in fetching the data from database.
    From the following code :
    If the where condition is removed then the application runs fine but i am still not able to fetch the data from the table because it is not showing any output.
    Can anyone please suggest me that how to write WHERE statement correctly and how i will be able to see the output.
    Following is the config.xml for processor:
    ======================================
    <?xml version="1.0" encoding="UTF-8"?>
    <wlevs:config xmlns:wlevs="http://www.bea.com/ns/wlevs/config/application"
         xmlns:jdbc="http://www.oracle.com/ns/ocep/config/jdbc">
         <processor>
              <name>JDBC_Processor</name>
              <rules>
                   <query id="q1"><![CDATA[
                             SELECT STOCK.SYMBOL as symbol, STOCK.EXCHANGE as exchange
                             FROM ExchangeStream [Now] as datastream, STOCK
                             WHERE datastream.SYMBOL = datastream.SYMBOL ]]></query>
              </rules>
         </processor>
         <jms-adapter>
              <name>JMS_IN_Adapter</name>
              <jndi-provider-url>t3://CHDSEZ135400D:7001</jndi-provider-url>
              <destination-jndi-name>jms.TestKanikaQueue</destination-jndi-name>
              <user>weblogic</user>
              <password>welcome1</password>
         </jms-adapter>
    </wlevs:config>
    Following is the assembly file:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:osgi="http://www.springframework.org/schema/osgi"
         xmlns:wlevs="http://www.bea.com/ns/wlevs/spring" xmlns:jdbc="http://www.oracle.com/ns/ocep/jdbc"
         xmlns:spatial="http://www.oracle.com/ns/ocep/spatial"
         xsi:schemaLocation="
              http://www.springframework.org/schema/beans
              http://www.springframework.org/schema/beans/spring-beans.xsd
              http://www.springframework.org/schema/osgi
              http://www.springframework.org/schema/osgi/spring-osgi.xsd
              http://www.bea.com/ns/wlevs/spring
              http://www.bea.com/ns/wlevs/spring/spring-wlevs-v11_1_1_3.xsd
              http://www.oracle.com/ns/ocep/jdbc
              http://www.oracle.com/ns/ocep/jdbc/ocep-jdbc.xsd
              http://www.oracle.com/ns/ocep/spatial
              http://www.oracle.com/ns/ocep/spatial/ocep-spatial.xsd">
         <wlevs:event-type-repository>
              <wlevs:event-type type-name="StockEvent">
                   <wlevs:properties>
                        <wlevs:property name="SYMBOL" type="byte[]" length="16" />
                        <wlevs:property name="EXCHANGE" type="byte[]" length="16" />
                   </wlevs:properties>
              </wlevs:event-type>
              <wlevs:event-type type-name="ExchangeEvent">
                   <wlevs:class>com.bea.wlevs.event.example.JDBC_CEP.ExchangeEvent</wlevs:class>
              </wlevs:event-type>
              <wlevs:event-type type-name="StockExchangeEvent">
                   <wlevs:properties>
                        <wlevs:property name="symbol" type="byte[]" length="16" />
                        <wlevs:property name="price" type="byte[]" length="16" />
                        <wlevs:property name="exchange" type="byte[]" length="16" />
                   </wlevs:properties>
              </wlevs:event-type>
         </wlevs:event-type-repository>
         <bean id="readConverter" class="com.bea.wlevs.adapter.example.JDBC_CEP.Adapter_JDBC" />
         <bean id="outputJDBCBean" class="com.bea.wlevs.bean.example.JDBC_CEP.OutputBean_JDBC">
         </bean>
         <wlevs:adapter id="JMS_IN_Adapter" provider="jms-inbound">
              <wlevs:listener ref="ExchangeStream" />
              <wlevs:instance-property name="converterBean"
                   ref="readConverter" />
         </wlevs:adapter>
         <wlevs:processor id="JDBC_Processor" advertise="true">
              <wlevs:listener ref="OutputChannel" />
              <wlevs:table-source ref="STOCK" />
         </wlevs:processor>
         <wlevs:channel id="ExchangeStream" event-type="ExchangeEvent" advertise="true">
              <wlevs:listener ref="JDBC_Processor" />
         </wlevs:channel>
         <wlevs:channel id="OutputChannel" event-type="StockExchangeEvent"
              advertise="true">
              <wlevs:listener ref="outputJDBCBean" />
         </wlevs:channel>
         <wlevs:table id="STOCK" event-type="StockEvent"
              data-source="StockDs" table-name="STOCK" />
         <wlevs:table id="STOCK_EXCHANGE" event-type="StockExchangeEvent"
              data-source="StockDs" table-name="STOCK_EXCHANGE" />
    </beans>
    ExchangeEvent.java:
    package com.bea.wlevs.event.example.JDBC_CEP;
    public class ExchangeEvent {
         public String SYMBOL;
         public String symbol;
         public String exchange;
         public ExchangeEvent() {
         public String getSYMBOL() {
              return SYMBOL;
         public void setSYMBOL(String sYMBOL) {
              SYMBOL = sYMBOL;
         public String getSymbol() {
              return symbol;
         public void setSymbol(String symbol) {
              this.symbol = symbol;
         public String getExchange() {
              return exchange;
         public void setExchange(String price) {
              this.exchange = price;
    Adapter Class:
    package com.bea.wlevs.adapter.example.JDBC_CEP;
    import com.bea.wlevs.adapter.example.JDBC_CEP.MyLogger;
    import com.bea.wlevs.adapters.jms.api.InboundMessageConverter;
    import java.text.DateFormat;
    import java.util.Date;
    import com.bea.wlevs.adapters.jms.api.MessageConverterException;
    import com.bea.wlevs.event.example.JDBC_CEP.ExchangeEvent;
    import javax.jms.JMSException;
    import javax.jms.Message;
    import javax.jms.TextMessage;
    import java.util.ArrayList;
    import java.util.List;
    import java.util.Random;
         public class Adapter_JDBC implements InboundMessageConverter{
         @SuppressWarnings("unchecked")
         public List convert(Message message) throws MessageConverterException, JMSException {
              Random rand = new Random();
              int unique_id = rand.nextInt();
              DateFormat dateFormat;
              dateFormat = DateFormat.getTimeInstance();
              dateFormat.format(new Date());
              MyLogger.info(unique_id + " CEP Start Time is: " + dateFormat.format(new Date()));
              System.out.println("Message from the Queue is :"+ message);
              TextMessage textMessage = (TextMessage) message;
              String stringMessage = textMessage.getText().toString();
              System.out.println("Message after getting converted into String is :"+ stringMessage);
                   String[] results = stringMessage.split(",\\s*"); // split on commas
                   ExchangeEvent event1 = new ExchangeEvent();
                   event1.setSYMBOL(results[0]);
         List events = new ArrayList(2);
         events.add(event1);
         return events;
    Output Bean Class :
    package com.bea.wlevs.bean.example.JDBC_CEP;
    import com.bea.wlevs.ede.api.StreamSink;
    import com.bea.wlevs.event.example.JDBC_CEP.ExchangeEvent;
    import com.bea.core.datasource.DataSourceService;
    public class OutputBean_JDBC implements StreamSink{
         public void onInsertEvent(Object event) {
         if (event instanceof ExchangeEvent) {
              ExchangeEvent cacheEvent = (ExchangeEvent) event;
         System.out.println("Symbol is: " + cacheEvent.getSymbol());
         System.out.println("Exchange is: " + cacheEvent.getExchange());
         System.out.println(DataSourceService.class.getClass());
    Kindly let me know if you need further info.

    Do you have StockDs configured in your server config.xml?
    I think the query should look more like this:
    SELECT stocks.SYMBOL, stocks.EXCHANGE
    FROM STOCK as stocks, ExchangeStream [Now] as datastream WHERE stocks.SYMBOL = datastream.SYMBOL
    Thanks
    andy

  • Getting the text of a Button when it is being read as a Node. Looping VBox

    I'm learning JavaFX and this is just a small programming question.
    I have 3 buttons in a VBox. And I want to apply the same 3 effects on all buttons after I put them in the Vbox. But when I use a for loop and getChildren() on the VBox, they are returned as 'Nodes'. I can't use the Button.getText() to find out the text of the button.
    Is there a way I can getText of a Node? Or maybe convert the current Node to a Button and get the text that way?
    VBox vbox = new VBox();
    Button option1= new Button("First Button");
    Button option2= new Button("Second Button");
    Button option3= new Button("View Rules");
    vbox.getChildren().add(option1);
    vbox.getChildren().add(option2);
    vbox.getChildren().add(option3);
    for (final Node button : vbox.getChildren())
    button.setOnMouseEntered(new EventHandler<MouseEvent>()
    @Override
    public void handle(MouseEvent arg0)
    button.setEffect(addEffect(Color.web("#53CFA6"), .8, 10));
    button.setOnMouseExited(new EventHandler<MouseEvent>()
    @Override
    public void handle(MouseEvent arg0)
    button.setEffect(addEffect(Color.web("#FF6800"), .8, 10));
    button.setOnMouseClicked(new EventHandler<MouseEvent>()
    @Override
    public void handle(MouseEvent arg0)
    button.setEffect(addEffect(Color.web("#E62800"), .8, 10));
    //Need to use button.getText()
    //Button button; button.getText() works
    }

    Hello user,
    You should have formatted your code properly. Look in the forum guides to format the codes.
    For getting the instance of Button , You need to do it safely
    There are two ways to get instance of Button.
    for (final Node button : vbox.getChildren()){
         Button b = null;
         if(button instanceof Button){
              b = button;
         if(b != null){
              //Do your stuffs here
    }Or You can even do like this too
    for (final Node button : vbox.getChildren()){
         Button b =null;
         try{
              b = (Button) button; //casting the class
         catch(ClassCastException e){
              e.printStackTrace();
         if(b != null){
              //Do your stuffs here
    }Thanks
    Narayan

  • I recently bought a new macbook pro and set it up using the migration assistant and my mac mini.  I can't get the text message forwarding feature to work with both computers.

    I recently bought a new macbook pro and set it up using the migration assistant from my mac mini.  I can't get the text message forwarding feature to work with both computers.  It keeps saying that I only have 2 devices setup, my iPad and my macbook pro.  When I mess with the setting on my mac mini, it goes from saying that that is one of the devices to my macbook pro being the 2nd device.  I think that something happened as a result of my using the migration assistant and now it thinks that my macbook pro and my mac mini are one and the same computer.  Any ideas?

    Thanks, Sig.
    The old computer is a 2.6 Ghz Intel Core 2 Duo
    The new one is a 2.3 GHz intel core i7
    In going over this, thanks to "tallking it out" with you, I did discover the Text Edit problem.  Because I've still been unable to get the new computer text size (fonts or whatever) to match the old computer, I did not notice that the curser is now different--the line midway down the curser has to be placed on the line I am working upon, otherwise the edits go elsewhere on the page.  Now, with a bit of difficulty, I am able to get Text Edit to work correctly.
    If you have any ideas as to why my menu bar and Text Edit type are still so slow, I'd love to have them. 
    (I went through the process you suggested earlier, re my Trackpad preferences, and found no improvement.)

  • When I import video and place it into timeline as a raw file with no fx or any added processing I get the message that the video is unrendered and therefore it doesn´t playback?

    When I import video and place it into timeline as a raw file with no fx or any added processing I get the message that the video is unrendered and therefore it doesn´t playback?

    FCE can use DV or AIC video formats natively.  Any other format will need to be converted to one of those two if you want to avoid constant rendering.  The clips you use must match the Sequence settings.
    -DH

  • I tried to install yosemite yesterday and my computer goes through the whole installation process and then to a blank white screen.  I've rebooted, I've reinstalled several times and get the same result.  Two days wasted!

    I tried to install yosemite yesterday and my computer goes through the whole installation process and then to a blank white screen.  I've rebooted, I've reinstalled several times and get the same result.  Two days wasted and I can't use my computer!!

    I don't know if you've already resolved your problem, but I had the same thing, it took me 6 hours to fix it. I had the exact same as you, installed the update and then it went to a white screen. After trying start up holding down cmmd r or holding down the alt key to try to install it again, nothing worked, same result every time. Then an angel came to me here somewhere but I can't find it now to thank him. Start in safe mode, press shift once you hear the start up chime and hold it down until you hear it again. Installation completion box came up and it was working. turn off computer and start up again normally and all is well. Except my final cut pro x doesn't work with it, have to update that now too. same as when I updated to mavericks.
    Hope this helps.

  • I have Windows 7 and PS Elements 10 and can't get the text button to work properly.  What can I do?

    I have Windows 7 and PS Elements 10 and can't get the text button to work properly.  What can I do?

    Try selecting the T tool and then doing a reset (see image below)

  • I get a dialogue box asking "What should Firefox do with this file" Options open with or save file. My wife selected save file and now it only opens note pad and displays the text of the file to be saved. OK in windows Internet Explorer.

    I get a dialogue box asking "What should Firefox do with this file" Options open with or save file. My wife selected save file and now it only opens note pad and displays the text of the file to be saved. OK in windows Internet Explorer.

    P.S. Site is http://www.coldwatercreek.com

  • When and How to get the Text.ScrollPos value of a String control when scroll bar position changed

    Hi, 
    I'm working on a feature triggered by scroll bar position of a string control changed.
    But I could not find a good way to catch the scroll bar position changed event, 
    the scroll bar is controlled manually by mouse down → mouse move → mouse up, I want the get the Text.ScrollPos value when user mouse up, and compare with the maximum value.
    But the problem is,  mouse up on the scroll bar could not trigger String: Mouse up event!
    So I have to get the Text.ScrollPos continuously in the background in Timeout event, but I think it’s not efficient.
    Do you have any better idea on when to get the correct destination value of Text.ScrollPos?
    I plan to store the value of Text.ScrollPos in the bottom(maximum value) in a shift register, then compare the current Text.ScrollPos value with the max one.
    If it comes close to the bottom(90%~100% of the maximum value), then the close to bottom LED will turn on.
    Attachments:
    scroll bar pos changed.vi ‏15 KB

    Hello Cecilia,
    I don't think there is any build-in event for this.
    One solution would be to create your own user event at the initialisation of you main and launch a thread which is going to be pulling the value of your scrollbar position:
    Then you can build your main as if they were a scrollbar move event.
    And dont forget to close the thread and destroy the event at the end.
    Hope it helps.
    Attachments:
    Scrollbar event.PNG ‏10 KB

  • HOWTO Get the text of "combo box" and "labe" controls with JavaAccessBridge

    HOWTO Get the text of "combo box" and "labe" controls with JavaAccessBridge.
    Please help,
    I'm trying to use the Java Access Bridge (JAB) 2.1 to get the text in Java Applet controls. I've been able to use the sample code in AccessInfo.cpp sample that comes with JAB to get text from "text" controls in a Java Applet. To clarify, I am referring to the "role" in the AccessibleContextInfo struct being set to "text" or "combo box" or "label".
    The problem is, when I use the AccessInfo.cpp sample to get text from a "combo box", the accessibleText data member comes back as FALSE, and thus any of the JAB text functions like GetAccessibleTextInfo fail to get any text information from "combo box" or "label" controls.
    I've also tried GetCurrentAccessibleValueFromContext on the "combo box" and "label" controls, but the text returned is empty.
    Can anyone help?

    I have new information in regards to this issue. A contact from Sun did get to me in email and relayed that that "label" objects store their text in the "name" data member of the AccessibleContext structure. This was a big help.
    But I'm still stuck trying to get information from "combo box" and other controls, like "push button". The contact said, the Java Access Bridge does not provide all the information because it is already implemented by other interfaces like AccessibleComponent, AccessibleAction, or AccessibleSelection. The contact did not allude to whether these opther interfaces can be used along side the Java Access Bridge or not. So, I'm left a step closer to the goal, but still stuck without the full solution.
    Can one take the Java Access Bridge functions, like say those used in the Ferret sample, and close the gap to get text back from "combo box", "push button", and other controls by using some other API in conjunction?

  • HT1414 I backed up my iphone last weekend.  Today (one week later), I was downloading music and noticed the text messages I send to myself (about 1 1/2 years worth) are gone.  Now, I can't find the backup from last week to try to get them back.  help???

    I backed up my iphone last weekend.  Today (one week later), I was downloading music and noticed the text messages I send to myself (about 1 1/2 years worth) are gone.  Now, I can't find the backup from last week to try to get them back.  help???

    You cannot update iPhone 4 to IOS 8.1.2, the highest you can update is IOS 7.1.2.
    Unless you've iPhone 4S (looks similar to iPhone 4)

  • Why do I get the text notification when still in the text and someone responds?

    When I am texting with someone and the text is still showing on the screen I get the text notification every time they respond.
    I have my text tone set to tri-tone, reminder alerts to none and vibrate off.
    It wasn't always like this and it's driving me nuts.
    Thanks for any help you can give me.

    Someone answered in another thread.  They told me to turn the phone off and wait a minute or 2 before turning it back on and it worked!  Just thought I would share in case anyone else was having this problem.

  • When I get messages from Barnes and Noble, the text is blank. If I hit reply or forward, I can then see the content. This only happens with Barnes and Noble. Any suggestions on how to view the content?

    When I get messages from Barnes and Noble, the text is blank. If I hit reply or forward, I can then see the content. This only happens with Barnes and Noble. Any suggestions on how to view the content?

    I'm sorry, but your sister, unless she had already turned on the "Find my iPhone" feature and the person who took the phone has not disabled it, is out of luck. She should report the theft to local police authorities, including the serial number of her iPhone. While her experience is unfortunate, there are good reasons why Apple cannot do anything else about it.
    I hope she gets her phone back.
    Best of luck.

  • HT5622 My mom keeps on getting the texts my friends send to me and I don't know what to do!

    my mom keeps on getting the texts that my friends send me and I don't know what to do!

    Are you both sharing the same apple id?  If you are, then this is the reason.
    ON both devices - go to settings - message - send&receive - remove or uncheck the apple id. \
    Do the same for start a new convo.

Maybe you are looking for

  • 6D low light video

    Hello, I'm trying to shoot video in low light and I'm getting some extra hue and contrast.  When I shoot stills, what I see on the screen is what I see on my computer.  When I flip over to video (with out changing ISO or WB settings) the images are d

  • VLM configuration problem in RHEL 3.0

    Hello I am using oracle 10g R2 in RHEL3.0. My kernel version is 2.4.21-37.ELsmp. So, it will support upto 16GB RAM. I have 8GB RAM installed and so want to increase SGA size using VLM. I have following configuration in my spfile: *.compatible='10.2.0

  • Plz some body answer for this..its urgent

    Hai can anyone help me? I have lengthy report containing 1000s of Records in it.. When i disply this report in viewer,i have to use horizontal scroll bar of IE to view the lengthy report,which will in turn display long page ofit. But,My requirement i

  • I can't able to access shapes(circle,star) in tool,only rectangle is used.what to do for drawing other shapes?

    i can't able to access shapes(circle,star) in tool,only rectangle is used.what to do for drawing other shapes?

  • Editing and saving RAW in Photoshop CS3 and iPhoto

    So I have a specific question. I right click an Image, select "edit in external editor" then edit RAW image using CS3, so far so good. But then I save it "in existing folder", so I have a .jpg of my edited image. NOW what I want to do is have that fi