How to? multiline label containing exact system command output

Background info: I'm triggering a system command to display memory utilization. As you know, the "free" linux command displays many lines of text one after the other. It is similar to the mem command used in Window$.
I want to have a label displaying the command output as it is: multiple lines. Just like you see it in the console. I want to mirror whatever comes up on console after executing free from java.
Using html tags won't work out for me in this particular situation. It just doesn't do the trick. Still displays the LAST line of command output with or without html tags.
any ideas? it doesn't have to be a label. It can be anything as long as it works.
Again, as it is, it just displays the last line of the command output
//events will trigger every second
Timer t = new Timer(1000, new ActionListener(){
      public void actionPerformed(ActionEvent event)
//determine memory utilization.
        String cmd = "free -m";
    try {
     String line;
     Process p = Runtime.getRuntime().exec(cmd);
     BufferedReader input =
       new BufferedReader
         (new InputStreamReader(p.getInputStream()));
     while ((line = input.readLine()) != null) {
       label.setText(line);
     input.close();
    catch (Exception err) {
     err.printStackTrace();
    t.start();

got it. thanks.
String cmdMem = "free -m -t -o" ;
      try {
        String lineMem ;
        String outputMem = "" ;
        Process procMem = Runtime.getRuntime ().exec ( cmdMem ) ;
        BufferedReader input =
            new BufferedReader
            ( new InputStreamReader ( procMem.getInputStream () ) ) ;
        while ( ( lineMem = input.readLine () ) != null ) {
          outputMem = ( lineMem + "\n" ) ;
          jTextAreaSystemResourcesOutput.append ( outputMem ) ;
        input.close () ;
      catch ( Exception err ) {
        err.printStackTrace () ;
      }

Similar Messages

  • How does client invoke an operating system command in the Server machine.?

    Guys,
    Is there any way that a client could trigger an operating system command on the Oracle Server machine?
    I've a VB scipt file in the server machine.My requirement is to execute that VB file on the server machine.(The script would essentially create a DSN on the server machine).
    The normal way to execute a VB script would be to specify the name of the file in the command prompt.(If my VB script ONDEMAND.VBS resides in C:\ONDEMAND folder,I need to execute the statement
    "C:\ONDEMAND\ONDEMAND.VBS" in the command prompt to get it executed.)
    I would utilise the SQL command below
    HOST C:\ONDEMAND\ONDEMAND.VBS
    to invoke it programatically(from a PL\SQL scipt).
    Can someone help me in utiliting HOST command in Oracle(Or by any other means) for a client database operation to execute an Operating system command in the Oracle server machine?
    Thanks,
    Bhagat

    Hi Bhagat,
    This has been asked several times recently:
    Executing Shell Script from PL/SQL Block
    Fire an executable using oracle
    Cheers,
    Colin

  • Operating system command in file receiver adapter

    Hi,
    How to use the Run Operating system command after message processing option in the parameters tab of the file receiver adapter.
    I am working on a scenario wherein a batch file needs to be invoked after the file is written on the file system.
    So how do i invoke this batch file from the file reciever adapter ( Run Operating system command after message processing ).

    Hi,
    did you see this page?
    http://help.sap.com/saphelp_nwpi71/helpdata/en/44/556cb799c93677e10000000a114a6b/content.htm
    it shows all you need to know
    Regards,
    Michal KRawczyk

  • How to call Operating System commands / external programs from within APEX

    Hi,
    Can someone please suggest how to call Operating Systems commands / external programs from within APEX?
    E.g. say I need to run a SQL script on a particular database. SQL script, database name, userid & password everything is available in a table in Oracle. I want to build a utility in APEX where by when I click a button APEX should run the following
    c:\oracle\bin\sqlplusw.exe userud/password@database @script_name.sql
    Any pointers will be greatly appreciated.
    Thanks & Regards,

    Hi Guys,
    I have reviewed the option of using scheduler and javascript and they do satisfy my requirements PARTIALLY. Any calls to operating system commands through these features will be made on the server where APEX is installed.
    However, here what I am looking at is to call operating systems programs on client machine. For example in my APEX application I have constructed the following strings of commands that needs to be run to execute a change request.
    sqlplusw.exe user/password@database @script1.sql
    sqlplusw.exe user/password@database @script2.sql
    sqlplusw.exe user/password@database @script3.sql
    sqlplusw.exe user/password@database @script4.sql
    What I want is to have a button/link on the APEX screen along with these lines so that when I click that link/button this entire line of command gets executed in the same way it would get executed if I copy and paste this command in the command window of windows.
    Believe me, if I am able to achieve what I intend to do, it is going to save a lot of our DBAs time and effort.
    Any help will be greatly appreciated.
    Thanks & Regards,

  • Please help how to run System commands and batch files thru java program

    Sir,
    I want execute OS commands like dir,cls..etc and batch files,.exe filesthru java program.
    I have tried it sofar thru Runtime.getRuntime().exec("execute.bat");
    but it is not working.anybody knows about how to run the system commands thru java please give me the code.
    thank you,
    regards,
    j.mouli

    I've seen other posts with this questions, and answers. Unfortunately I didn't pay much attention. But the basic idea is to exec command.com and pass the specifc batch or command as an argument.

  • How to use Operating System Commands while using define in sqlplus

    How to use Operating System Commands while using define in sqlplus . The Host OS is Linux
    define report_name=PROD_${host date "+%b"}.html
    The above is not working.
    The output should be 
    define report_name=PROD_JAN.html
    Regards,
    DB

    of course I was talking nonsense: the problem here is the mixing of bind variables and DEFINE variables.
    With the following changes the script should work (the conditions for begin_interval_time are perhaps not what you want):
    variable snap1 number
    variable snap2 number
    variable rptname varchar2(20)
    begin
    SELECT min(snap_id) into :snap1 FROM dba_hist_snapshot WHERE CAST(begin_interval_time AS DATE) >= SYSDATE-1;
    SELECT max(snap_id) into :snap2 FROM dba_hist_snapshot WHERE CAST(begin_interval_time AS DATE) >= SYSDATE-1;
    end;
    col file_name_value new_value report_name noprint
    select 'PROD_'|| to_char(sysdate,'MON') || '_' ||  to_char(sysdate,'DD') file_name_value  from dual;
    define  report_type  = 'html'
    define num_days=2
    define begin_snap=:snap1
    define end_snap=:snap2
    @@?/rdbms/admin/awrrpt.sql

  • How to execute System command through Applet

    Hi all,
    How can I execute a System command through Applet.
    I have written a code Runtime.exec("ls") in my applet but it gives me
    this execption even if I certify the applet ->
    java.security.AccessControlException: access denied (java.io.FilePermission <<ALL FILES>> execute)
         at java.security.AccessControlContext.checkPermission(AccessControlContext.java:272)
         at java.security.AccessController.checkPermission(AccessController.java:399)
         at java.lang.SecurityManager.checkPermission(SecurityManager.java:545)
         at java.lang.SecurityManager.checkExec(SecurityManager.java:802)
         at java.lang.Runtime.exec(Runtime.java:548)
         at java.lang.Runtime.exec(Runtime.java:418)
         at java.lang.Runtime.exec(Runtime.java:361)
         at java.lang.Runtime.exec(Runtime.java:325)
         at Test.init(Test.java:24)
         at sun.applet.AppletPanel.run(AppletPanel.java:344)
         at sun.plugin.navig.motif.MotifAppletViewer.maf_run(MotifAppletViewer.java:123)
         at sun.plugin.navig.motif.MotifAppletViewer.run(MotifAppletViewer.java:119)
         at java.lang.Thread.run(Thread.java:484)
    Thanks,
    Manoj.

    There should be a lesson about this somewhere.
    When you visit a web page, does it ask you if you want to have an applet loaded?
    Answer: No
    So, if you visit a page, and an applet is silently loaded which can then execute commands on your computer, is this good?
    Answer: No
    So why do you want to do this?
    Is it good for anyone?
    I mean, if I want to do "ls", can't I just open a command line? Do I need an applet to do it for me?
    Either you have devious desires or your hacking together something that probably shouldn't be.
    If you want to learn start here:
    http://java.sun.com/docs/books/tutorial/security1.2/index.html
    With the article entitled:
    Quick Tour of Controlling Applets
    Ian

  • How to execute a system command with call executable in teststand 4.2.1?

    Hi All,
          how to execute a system command with "call executable" step in teststand 4.2.1?
          example as i want to quit a application.using "taskkill /f /im xxx.exe".And execute other system command(DOS).
    BR
    Johnny

    Hi, 
    I want to run netstat -an | find "8080" command from command prompt using call executable in test stand. after that i would like take the std output to local variable. 
    Attachments:
    callsettings.jpg ‏404 KB

  • How System Command can replace a file in Application Server

    Hi Guys,
                  A new system Command is created. When that system command is executed, the client wants to take a file from one directory in application server and put that file into another directory on the application server itself. How this can be achieved?
                 What I know is we can create a function module and place that function module in the system command. But in that function module, I have to change the fielname and put that into another directory. I don't know how to do it.
    Note: I shouldn't read the data from the file using Open Dataset statements..
    Please let me the solution if any one has encountered such a scenario.
    Regards.
    Hari.

    I think you are mixing up things here.
    The program "sapiconv" is for converting files into different codepages, it´s not for copying/moving files to other directories.
    If you want to use the ZSAPICONV to you need to modify it, take out the "sapiconv" and put in the "mv" (move) command to move the file to the other directory.
    I suggest though creating a NEW command. e.g ZMV and give the appropriate parameters.
    Markus

  • How can I pass system commands from a java program? Urgent!

    hi,
    I have been trying this out since a long time. How do I send system commands to command.com or cmd.exe from a java program and an output of the executed command back to the java application.
    If u have any idea, or have any information about the kind os application reply back.
    Thanks
    Deepa Datar

    This is the code which I tried, but it displays only the title of MS-DOS, something like " Microsoft Corp...etc ". But doesn't take any input, and the subprocess(cmd.exe) hangs.
    import java.io.*;
    public class cmddemo2
    public static void main(String arg[])
    try
    System.out.println("cmd");
    Process p=Runtime.getRuntime().exec("cmd.exe");
    DataInputStream din=new DataInputStream(p.getInputStream());
    DataOutputStream dout=new DataOutputStream(p.getOutputStream());
    System.out.println("after streams");
    String s;
    dout.writeChars("type cmddemo2.java");
    while((s=din.readLine())!="\n")
    System.out.println(s);
    dout.writeChars("dir");
    String s1;
    while((s1=din.readLine())!="\n")
    System.out.println(s1);
    System.out.println("over");
    catch(Exception e)
    { System.out.println("Exception : "+e);

  • How to run system commands from JAVA

    Hi Friends,
    How to run windows system commands from JAVA
    Runtime r=Runtime.getRuntime();
    r.exec("dir");
    Throwing following Exception
    CreateProcess :dir error=2
    Thanks in advance
    Hamsa

    Hi ,
    in Windows NT this is not possible, you can use the following :
    Runtime r=Runtime.getRuntime();
    StringBuffer sbuf = new StringBuffer();
    String dir = new String();
    java.lang.Process proc = r.exec("cmd /c dir");
    InputStream is = proc.getInputStream();
    int ch ;
    while((ch=is.read() ) != -1)
    sbuf.append((char)ch);
    is.close();
    dir = sbuf.toString();
    System.out.println(dir );

  • How to call systems commands

    Hello guys,
    I will like to know if there is a way of calling system command and shell commands in windows without making use of the Runtime Class in java.
    Also when ever i call a system command or shells commands from my java application using the runtime class, it open the a new shell(Command Prompt) before executing the command.
    I await your response. Thanks in advance.
    Joe.

    How about this? http://onesearch.sun.com/ClickThru?qt=without+command+window&url=http%3A%2F%2Fforum.java.sun.com%2Fthread.jsp%3Fforum%3D31%26thread%3D440546&pathInfo=%2Fsearch%2Fdevelopers%2Findex.jsp&hitNum=2&col=devforums

  • How to execute Operating System commands from Stored procedure.

    Any help on how to execute Operating System commands from stored procedures will be appreciated.
    Nanditha.

    Search the forums for 'External Procedure' and you will find example code that has been posted before.

  • How to Run Operating System Command Before/After Message Processing SAP PI

    Hi,
    We are trying to execute multiple commands via "Operating System Command Before/After Message Processing".
    When we use single command say for example cp or mv (copy or move) the commands get executed fine.
    eg: cp %F /var/opt/data/outbound/Test/Dummy.txt 
    /this works fine/
    when we club commands together or try to redirect the outputs of commands, none of the commands get executed.
    eg:
    cp %F /var/opt/data/outbound/Test/Dummy.txt ; rm %F
    or
    wc -l %F > /var/opt/data/outbound/Test/Dummy.txt
    Is it possible to execute multiple commands or redirect the output  of commands without using a shell script? The PI server we are working on iis hosted on UNIX environment.

    Hi Harleen,
    try like this
    cp %F /var/opt/data/outbound/Test/Dummy.txt ; rm %F
    instead of semicolon try this
    (1) &
    command1 & command2
    Execute Command1 and then execute Command2
    (2) &&
    command1 && command2
    Runs the command2 only when command1 doesn't Complete successfully
    (3) ||
    command1 || command2
    Runs the second command if the first command had an error
    (4) ()
    (command1 || command2) || (command3 & command4)
    Defines the order in which commands are to be executed
    Regards
    Suraj

  • How to execute a system command on a remote UNIX server?

    I would like to execute a system command (for example "df") on a remote UNIX machine.
    A simple example would be welcome...
    Thanks

    I would like to execute a system command (for example
    "df") on a remote UNIX machine.
    A simple example would be welcome...None will be forthcoming.
    Executing a process is relatively simple. However doing this on a remot system is another matter.
    See http://sourceforge.net/projects/sshtools/
    and/or http://javassh.org/space/start
    Other resources to be found with Google.

Maybe you are looking for

  • Repeating field on each page

    Dear all, My XML source: <?xml version="1.0" encoding="UTF-8"?> <!-- Generated by Oracle Reports version 10.1.2.3.0 --> <XXAP_INVOICE_REGISTER> <LIST_G_HEADER> <G_HEADER> <INVOICE_ID1>212884</INVOICE_ID1> </G_HEADER> </LIST_G_HEADER> <CP_OPERATING_UN

  • Startx fail to start in VMWare

    Here's the log file: [ 29.885] X.Org X Server 1.16.2 Release Date: 2014-11-10 [ 29.885] X Protocol Version 11, Revision 0 [ 29.885] Build Operating System: Linux 3.17.2-1-ARCH x86_64 [ 29.885] Current Operating System: Linux Weis-rMBP 3.17.2-1-ARCH #

  • Hi Open item question in FI

    Hi Am using 2 Fi tables for BW One is BSIS and 2nd is BSAS. Now i want to know whether that account is open or not. As per my knowedge we can get the info from BSIS table. But my doubt is BSIS table should maintain one field to store the info is open

  • Mac unable to locate HP ENVY 5532 on network during configuration - device not reachable

    I have MacBook Pro with OSX 10.9.5 and HP ENVY 5532. I have had it set up and configured for over a year but have always had a problem with scanning. Today after becoming frustrated that the scanning capabilities no longer worked, I found another thr

  • Fatal error: Call to undefined function ocilogon() in d:\SITO\VENTST.php on

    Hi all, when I use this php script <?php $db_conn = ocilogon("venus_pkg","venus_pkg","ventst"); ?> I get this error: Fatal error: Call to undefined function ocilogon() in d:\SITO\VENTST.php on line 3 How to configure Apache 1.3.3 with PHP version 5 t