How to get CPU status in Java program

Is there any way by which we can get CPU status in a java program ?
Whats the load on the cpu, whats the max it can handle ? and stuff like that.
Thanks in advance

It's not that there's "no way" to do it in Java, nor that native code is required. However, it's a non-portable solution. If you find a solution that works on Linux (e.g. read the cpu info from /proc), it probably won't work on any other OS. Typically, these problems are solved by:
1) Executing an external program and parsing the results
2) Finding the required information in /proc (not on Windows, though)
3) Writing some kind of JNI interface (again, OS-specific)
Brian

Similar Messages

  • How to get oc4j version from Java program

    i have the following in my Java Program
    Runtime r = Runtime.getRuntime();
    Process p = r.exec("java -jar oc4j.jar –version");
    and then i try to read the InputStream from the Process p.
    but this line is not executing, it returns the following error.
    Unknown switch: ?version, type java -jar oc4j.jar -? for help
    if i change it to ----------
    Runtime r = Runtime.getRuntime();
    Process p = r.exec("java -jar $ORACLE_HOME/j2ee/home/oc4j.jar –version");
    then i get another error :
    Exception in thread "main" java.util.zip.ZipException: No such file or directory
    at java.util.zip.ZipFile.open(Native Method)
    at java.util.zip.ZipFile.<init>(ZipFile.java:112)
    at java.util.jar.JarFile.<init>(JarFile.java:127)
    at java.util.jar.JarFile.<init>(JarFile.java:65)
    but if i cd to /oracle/j2ee/home and then run the command java -jar oc4j.jar –version, then it gives me the right output with the right version, but for some reason the samething from inside the java program is giving me errors,
    please help. i just need to read the oc4j version running on the server and display it in JSP.

    Process p = r.exec("java -jar oc4j.jar –version");The character before "version" should be a hyphen; yours is not.
    Process p = r.exec("java -jar $ORACLE_HOME/j2ee/home/oc4j.jar –version");
    then i get another error : Exception in thread "main"
    java.util.zip.ZipException: No such file or directory
    at java.util.zip.ZipFile.open(Native Method)
    at java.util.zip.ZipFile.<init>(ZipFile.java:112)
    at java.util.jar.JarFile.<init>(JarFile.java:127)
    at java.util.jar.JarFile.<init>(JarFile.java:65)One more problem here: $ORACLE_HOME will be not be interpreted in the runtime.exec even if it is defined as an environment variable. So you get an error that tells you oc4j.jar is not found.
    Hope this helps you.

  • How to read system evenlog using java program in windows

    How to read system evenlog using java program in windows???
    is there any java class available to do this ? or any one having sample code for this?
    Your friend Zoe

    Welcome to the Sun forums.
    >
    How to read system evenlog using java program in windows???>
    JNI. (No.)
    >
    is there any java class available to do this ? or any one having sample code for this?>You will generally get better help around here if you read the documentation, try some sample code and come back with a specific question (hopefully with an SSCCE included).
    >
    Your friend Zoe>(raised eyebrow) Thank you for sharing that with us.
    Note also that one '?' denotes a question, while 2 or more generally denotes a dweeb.

  • How to get acknowledgement status for PO

    Hi!
    I would like to write a program which gets the acknowledgement status from IDoc Processing for a given purchase order number.
    How can I do that? In which table can I find the link between IDoc and PO? How to get the status?
    Thanks in advance
    Christian

    EDIDS -- table
    Check in the below link to update the staus and find the application objectof an idoc
    http://www.sapgenie.com/sapedi/idoc_abap.htm#Getting%20IDocs%20linked%20to%20Application%20documents

  • How to get system status and user status of service order

    Hi,
    I want to show user status and system status for service order in my report and i am using CRM_ORDER_READ function module to read the status, but it is returning lot of status records, could anyone please suggest how to get the system status and user status for service order.
    I did not find any clue for how to get user status, i can see the user status when i open the transaction using CRMD_ORDER.
    Regards,
    Kamesh Bathla

    Hi,
      Go to CRM_JEST table give your service order guid and get the status, pass this status into TJ02. You will get the status of your order.
    Regards
    Srinu

  • How to change system time through java program

    Hi
    I want to know, how to change system time through java program.
    give me a idia with example.
    Thanks

    There isn't any core Java API for this. Use JNI or call an external process with Runtime.exec().
    ~

  • How to get the status of service in rac

    Dear all,
    how to get the status of service in rac.
    SQL> show parameters service;
    NAME                                 TYPE        VALUE
    service_names                        string      DEVDB, DEVDB1, devdb
    [oracle@rac1 ~]$ srvctl status service -d devdb -s devdb
    PRKO-2120 : The internal database service devdb cannot be managed with srvctl.

    user7244870 wrote:
    Dear all,
    how to get the status of service in rac.
    SQL> show parameters service;
    NAME                                 TYPE        VALUE
    service_names                        string      DEVDB, DEVDB1, devdb
    [oracle@rac1 ~]$ srvctl status service -d devdb -s devdb
    PRKO-2120 : The internal database service devdb cannot be managed with srvctl.
    Internal services cannot be managed with srvctl utility. Check if you have any user defined service in dba_services
    SQL> desc dba_services
    Name                                      Null?    Type
    SERVICE_ID                                         NUMBER
    NAME                                               VARCHAR2(64)
    NAME_HASH                                          NUMBER
    NETWORK_NAME                                       VARCHAR2(512)
    CREATION_DATE                                      DATE
    CREATION_DATE_HASH                                 NUMBER
    FAILOVER_METHOD                                    VARCHAR2(64)
    FAILOVER_TYPE                                      VARCHAR2(64)
    FAILOVER_RETRIES                                   NUMBER(10)
    FAILOVER_DELAY                                     NUMBER(10)
    MIN_CARDINALITY                                    NUMBER
    MAX_CARDINALITY                                    NUMBER
    GOAL                                               VARCHAR2(12)
    DTP                                                VARCHAR2(1)
    ENABLED                                            VARCHAR2(3)
    AQ_HA_NOTIFICATIONS                                VARCHAR2(3)
    CLB_GOAL                                           VARCHAR2(5)http://docs.oracle.com/cd/B19306_01/rac.102/b14197/srvctladmin.htm

  • How to get on the apple seeding program?

    How to get in the apple seeding program. I really want to to test apples new iOS software.

    Yes, but if you're not already a developer you shouldn't be testing beta software.
    You shouldn't test beta versions of iOS on your day-to-day phone. You should have dedicated phone just for testing and it needs to be registered with Apple.
    Being part of the developer program and having access to iOS betas is not intended for just curious, non-developer people. It is for real developers who need to test their own apps on future versions of the OS and provide detailed feedback to Apple for bug fixing.
    If you're just curious about new OSs, don't bother.

  • How to get Invoice status value in oracle payable

    Hi guys,
    I am new in oracle apps plz tell me how to get invoice status value of prepayment invoice type in payable.
    Navigation ->Payables->Oracle Payables ->Invoices->Inquiry->Invoices ->go to Invoice status block and open to Status LOV
    plz provide me sql query to find those status lov values and accounted values for any supplier & invoice num.
    it's urgent plz .......................
    Thanks guys.......

    The invoice approval status does not come from any table / lookup.
    Instead, Oracle builds it by calling the ap_invoices_pkg.get_approval_status function.
    You can also call it by passing invoice_id, payment_status_flag and invoice_type_lookup_code.
    All these 4 columns are present on the ap_invoices_all record.
    Hope this helps
    Sandeep Gandhi
    Independent Consultant

  • How to read system eventlog using java program in windows?

    How to read system eventlog using java program in windows?
    is there any java class available to do this ? or any one having sample code for this?
    Your friend Zoe

    Hi,
    There is no java class for reading event log in windows, so we can do one thing we can use windows system 32 VBS script to read the system log .
    The output of this command can be read using java program....
    we can use java exec for executing this system32 vbs script.
    use the below program and pass the command "eventquery"
    plz refer cscript,wscript
    import java.io.*;
    public class CmdExec {
    public static void main(String argv[]) {
    try {
    String line;
    Process p = Runtime.getRuntime().exec("Command");
    BufferedReader input =
    new BufferedReader
    (new InputStreamReader(p.getInputStream()));
    while ((line = input.readLine()) != null) {
    System.out.println(line);
    input.close();
    catch (Exception err) {
    err.printStackTrace();
    This sample program will list all the system log information....
    Zoe

  • How to get System status Check Boxes into Query selection screen

    Dear experts,
    Pleas help in knowing how to get System status Check Boxes into quick view query (SQVI), selectionscreen.
    Regards
    Jogeswara Rao
    Edited by: K Jogeswara Rao on Jul 6, 2010 7:26 PM

    Problem solved through other Forum
    (Checkboxes not possible, some alternative solution to my requirement found)

  • How to get system status and user status ?

    how to get system status and user status for the given production order?
    In which PP table we can
    find these?
    Thanks&Regards
    Satish

    Hi Ram,
    Use the FM "STATUS_READ" to read both the system and user statuses for an Order.
    Alternatively, the following tables store the user and system status info:
    JSTO- Status object information
    JEST- Individual Object Status
    Hope this helps.
    Let me know if u need further information.
    Regards,
    Sonal

  • Help--How can I open only one java program at one time?

    How can I open only one java program(same program) in Windows at one time?

    In Java 1.5, you can use the JVM's own monitoring APIs to examine what other JVMs are running on the system, and what applications they're running.
    It's general and powerful, but complex. The socket/file/whatever approach is cleaner, and probably more suited to your usage.
    Don't bother trying to use the Windows task manager for this sort of thing. You have to write messy native code, and it isn't reliable after all that anyway.

  • How to get invoice status columns available in invoice general screen

    Dear All,
    How to get invoice status in oracle invoices
    Invoice Status --> Validated, Never Validated, Cancelled etc
    please advice me.
    Thanks
    Rehan
    Edited by: 877432 on Oct 9, 2012 3:52 AM

    for
    >
    which is not giving this function kindly where i find these status.
    >
    re-read
    >
    plz see http://www.shareoracleapps.com/2010/10/api-to-find-ap-invoice-status.html
    also Where Is The Invoice Validation Status Stored? How Is The Invoice Validation Status Determined? [ID 301806.1]
    >
    those notes point about statuses - 'Validated' , 'Never Validated' , 'Needs Revalidation'
    if you want 'Unpaid' , 'Fully Applied','Available' etc instead of 'UNPAID', 'FULL', 'AVAILABLE' etc you can use lookups
    see note in http://andyblg.wordpress.com/2012/10/09/approval-status-for-invoice-in-r12/

  • How to copy pf-status from one program to another program

    Hi Gurus,
    Can any one tell me the procedure how to  copy pf-status of one program to another program .if i want to copy pf-status which is in production server to development server how can i do this.pls help me out.
    Regards.

    Hi,
    GO TO  SE41,
    Select Status,
    In from u can give  ur old pgm and staus name
    In To u can ur new one .
    Save and activate.
    Regards,
    S.nehru.

Maybe you are looking for

  • Transfer data in the Ztable from one client to another client in a same ser

    Hi all, How can i transfer or move data in the Ztable from one client to another client in a same server . Thanks Ajay

  • How to write this SQL query

    We have a table, the structure as below: (I put a blank row in the middle to make it clear) Product_ID     Retailer     Retail_Price 1001          A          1.2 1001          B          1.5 1001          C          1.4 1002          B          2.0 1

  • Videos won't work on windows vista beta 2

    Ok i Have windows vista beta 2 and most of my itunes work fine but videos won't show up, even when i bought one it dident show up, and that is really weird because everything works fine on my laptop with itunes and windows vista beta 2.Why won't it w

  • [SOLVED] Slow System Startup

    Hello, it is a few weeks that I'm experiencing slow startups. Previously my system was starting up in less than 15 seconds, but now it takes about 30 seconds to start up. I thought that issue will probably go away after a few updates but it still per

  • Analysis Authorization created in RSECADMIN

    Hi I created an alaysis authorization using the transaction RSECADMIN following the steps Step 1: Activate all business content related to authorizations before you get started:* InfoObjects: 0TCA* and 0TCT* InfoCubes: 0TCA* Set the following InfoObj