Need to track windows processes through java code.

Need to track windows processes through java code.
Eg: I want to find out whether an exe file (wrun.exe) is running or stopped.
Can I do it through java. If so can any one please tell me how to do it. That will be a great help.
Thanks,
Ramesh

There are 2 options for things like this:
1) Use Runtime.exec() to execute some command or application and parse the input from it.
2) Write some native code and use JNI to call it.

Similar Messages

  • How to find IP allocated to windows OS through java code

    Hi,
    I want to find no of IPs allocated to windows OS through java code. How i can do this.Please give me idea.
    any help will be appricated.
    Thanks in advance
    Ravi Adha

    You can use the InetAddress class in the java.net package to find all the IP addresses of your computer.

  • Running windows command through java code

    Hello
    i want to execute jar.exe through java code , i have written following piece of code , but it isn't working
    ProcessBuilder processBuilder = new ProcessBuilder(new String[]{"cmd.exe","/c","%java_home%\\bin\\jar.exe"});
              Process process = processBuilder.start();
              BufferedReader inputReader = new BufferedReader(new InputStreamReader(process.getErrorStream()));
              String line = inputReader.readLine();
              while(line != null){
                   System.out.println(line);
                   line = inputReader.readLine();
    does anybody knows why
    Regards
    Edited by: Mayur Mitkari on Mar 5, 2013 10:19 PM
    Edited by: Mayur Mitkari on Mar 5, 2013 10:20 PM
    Edited by: Mayur Mitkari on Mar 5, 2013 10:20 PM

    sorry for that , but the
    Runtime runtime = Runtime.getRuntime();
              Process proc = runtime.exec(new String[]{"cmd.exe","/c","jar"});
              proc.waitFor();
    int i = proc.exitValue();
    this code was different from first one
    and in case of Process if runtime .exec is succesful it is wainting for long time , in this case i want if the runtime.exec is succesful something should be returned
    Regards

  • Need to track windows processes running through java

    Hi All,
    Can any one please tell me a way to find out whether a process (exe file) is running in the system. I want to find out whether a file (wrun.exe) is running.
    Thanks,
    Ramesh

    Shorter: You can't
    Longer: WIN32API may have that functionality, so you should do some win32.c -code and use that via JNI...
    Maybe someone has already implemented the latter "WIN32API for Java"

  • Opening a word file in MS Office Word software window through Java code

    I want to open a word file in MS Office Word software window through Java code.
    Is it possible ? If possible then please let me now how can I do it.
    Bhoopender

    Thanks for replying.
    I tried the following code -
    public class OpenFileWithItsExt
         public static void main(String[] args) throws java.io.IOException
              Runtime.getRuntime().exec("a.doc");
    and it gets compiled successfully, but on running outputs as -
    Exception in thread "main" java.io.IOException: CreateProcess: a.doc error=193
    at java.lang.Win32Process.create(Native Method)
    at java.lang.Win32Process.<init>(Win32Process.java:66)
    at java.lang.Runtime.execInternal(Native Method)
    at java.lang.Runtime.exec(Runtime.java:566)
    at java.lang.Runtime.exec(Runtime.java:428)
    at java.lang.Runtime.exec(Runtime.java:364)
    at java.lang.Runtime.exec(Runtime.java:326)
    at OpenFileWithItsExt.main(OpenFileWithItsExt.java:5)
    My file is in the pesent working directoty.
    Please solve my problem.
    Thanks

  • Facing Error when BPEL Process is invoked through java code

    Hi,
    I wrote a BPEL process (HelloWorld) and deployed it on BPEL Process Server and running fine,even tested from console,it's working fine,but I am trying to invoke this process with java code from Jdeveloper10g.When this file is being run ,it's throwing following error:
    Exception in thread "main" java.lang.NoClassDefFoundError: javax/ejb/EJBException
         at com.oracle.bpel.client.util.ExceptionUtils.handleServerException(ExceptionUtils.java:88)
         at com.oracle.bpel.client.delivery.DeliveryService.getDeliveryBean(DeliveryService.java:303)
         at com.oracle.bpel.client.delivery.DeliveryService.request(DeliveryService.java:85)
         at com.oracle.bpel.client.delivery.DeliveryService.request(DeliveryService.java:55)
         at com.wips.TestClass.main(TestClass.java:26)
    Process exited with exit code 1.
    I have required jar in classpath.
    and my java code is as below:
    import com.oracle.bpel.client.Locator;
    import com.oracle.bpel.client.NormalizedMessage;
    import com.oracle.bpel.client.ServerException;
    import com.oracle.bpel.client.dispatch.IDeliveryService;
    import java.rmi.RemoteException;
    import java.util.Map;
    public class TestClass {
    public static void main(String[] args) throws ServerException,
    RemoteException {
    // String xml = "<ns1:input>, India</ns1:input>";
    String xml = "<ns1:HelloWorldProcessRequest><ns1:input>India</ns1:input></ns1:HelloWorldProcessRequest>" ;
    Locator locator = new Locator("default","bpel");
    IDeliveryService deliveryService = (IDeliveryService)locator.lookupService(IDeliveryService.SERVICE_NAME );
    NormalizedMessage nm = new NormalizedMessage( );
    nm.addPart("payload", xml);
    NormalizedMessage res = deliveryService.request("HelloWorld", "process", nm);
    Map payload = res.getPayload();
    System.out.println("HelloWorld Service Response is:"+payload.get("payload"));
    Could you figure out ,what might I missing over here..........
    Please help me out !
    Regards......
    Shaily

    Very-very thanks raphel,but still facing problem
    I did following changes in my code
    String xml = "<ns1:HelloWorldProcessRequest><ns1:input>India</ns1:input></ns1:HelloWorldProcessRequest>";
    Properties props=new Properties();
    props.setProperty("orabpel.platform","ias_10g");
    props.setProperty("java.naming.factory.initial","com.evermind.server.rmi.RMIInitialContextFactory");
    props.setProperty("java.naming.provider.url","opmn:ormi://localhost:9700/home/orabpel");
    props.setProperty("java.naming.security.principal","oc4jadmin");
    props.setProperty("java.naming.security.credentials","welcome1");
    props.setProperty("dedicated.rmicontext", "true");
    Locator locator = new Locator("default","bpel",props);
    IDeliveryService deliveryService = (IDeliveryService)locator.lookupService(IDeliveryService.SERVICE_NAME );
    NormalizedMessage nm = new NormalizedMessage( );
    nm.addPart("payload", xml);
    NormalizedMessage res = deliveryService.request("HelloWorld", "initiate", nm);
    // deliveryService.post("HelloWorld", "initiate", nm);
    Map payload = res.getPayload();
    System.out.println("HelloWorld Service Response is:"+payload.get("payload"));
    and response is herewith :
    Exception in thread "main" java.lang.NoClassDefFoundError: oracle/ias/opmn/optic/OpticException
         at com.oracle.bpel.client.util.ExceptionUtils.handleServerException(ExceptionUtils.java:94)
         at com.oracle.bpel.client.delivery.DeliveryService.getDeliveryBean(DeliveryService.java:303)
         at com.oracle.bpel.client.delivery.DeliveryService.request(DeliveryService.java:85)
         at com.oracle.bpel.client.delivery.DeliveryService.request(DeliveryService.java:55)
         at com.wips.TestClass.main(TestClass.java:39)
    Caused by: java.lang.NoClassDefFoundError: oracle/ias/opmn/optic/OpticException
         at com.evermind.util.OpmnHelper.<clinit>(OpmnHelper.java:24)
         at com.evermind.server.rmi.RmiServerLookupStrategy$StandardOpmnServerAccess.getOc4jServers(RmiServerLookupStrategy.java:160)
         at com.evermind.server.rmi.RmiServerLookupStrategy$OpmnLookupStrategy.getAvailableServers(RmiServerLookupStrategy.java:120)
         at com.evermind.server.rmi.RMIClientContext.establishLookupConnections(RMIClientContext.java:139)
         at com.evermind.server.rmi.RMIClientContext.establishRemoteConnections(RMIClientContext.java:165)
         at com.evermind.server.rmi.RMIInitialContext.get(RMIInitialContext.java:62)
         at oracle.j2ee.rmi.RMIInitialContextFactory.getInitialContext(RMIInitialContextFactory.java:59)
         at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
         at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
         at javax.naming.InitialContext.init(InitialContext.java:223)
         at javax.naming.InitialContext.<init>(InitialContext.java:197)
         at com.oracle.bpel.client.util.BeanRegistry.lookupDeliveryBean(BeanRegistry.java:277)
         at com.oracle.bpel.client.delivery.DeliveryService.getDeliveryBean(DeliveryService.java:299)
         ... 3 more
    Process exited with exit code 1.
    Regards,
    Shaily

  • How to kill a system process from java code.

    Hi,
    i need to kill or remove windows system process like cmd.exe from java code.
    like removing it from end process in task mgr.
    i tried below code but its not removed.
    is there a better way we can do this.
    killing a system process from java code will create any issues?
       public static void main(String[] args) throws Exception {
       String[] cmd = { "cmd.exe" };
       Process p = Runtime.getRuntime().exec(cmd);
       p.destroy();
    any suggestions or ideas are really appreciated.
    thanks.

    Hi  jtahlborn, mohan
    yes the process is created from my java code. 
    in my code iam creating a process like below and if it is running for a long i need to kill it from java.
    For that " Runtime.getRuntime().exec("taskkill /F /PID " +  7408); " is working fine.
    7408 is my process id in taskmgr created from java and iam manually passing the PID it to kill it.
    But i need to get the PID from java code.
    Thanks for your suggestions.
    Sample Code:
    public static void main(String args[])
            try {
              Process process = Runtime.getRuntime().exec(new String[]{"cmd.exe","/c","start"});        
              Field f = process.getClass().getDeclaredField( "handle");
              f.setAccessible( true);         
              long procHandle = f.getLong( process);
              System.out.println( "prochandle: " + procHandle );
              //Runtime.getRuntime().exec("taskkill /F /PID " +  procHandle);
            } catch( Exception e) {
              e.printStackTrace();

  • Implement callback for an asynchronous BPEL process through Java

    Hi ,
    I am trying to implement a callback functionality for an asynchronous BPEL process through java.
    I found the code in the samples folder of SOA suite installation folder .
    <SOA_HOME>\bpel\samples\tutorials\102.InvokingProcesses\rmi\com\otn\samples\async.
    There is an AsyncInstanceWatchdog object which registers a callback object(in this case an object of AsyncCallbackImpl class) for a specific CONVERSATION_ID.
    String convId = GUIDGenerator.generateGUID();
    nm.setProperty(NormalizedMessage.CONVERSATION_ID, convId);
    deliveryService.post(proc_name, "initiate", nm);
    // register the callback
    watchdog.registerAsyncCallback(convId, testAsyncHandler,
    locator.getDomainAuth());
    // start it
    watchdog.start();
    There is no problem till the last line. But once the BPEL process returns the control( does a callback), it throws the following error.
    May 25, 2010 3:36:06 PM oracle.j2ee.rmi.RMIMessages EXCEPTION_ORIGINATES_FROM_THE_REMOTE_SERVER
    WARNING: Exception returned by remote server: {0}
    ORABPEL-02118
    Variant not found.
    The variant "output" has not been declared in the current scope. All variants must be declared in the scope before being accessed.
    Please check that the variant "output" is properly declared; otherwise there may be a misspelling in the name of the variant.
         at com.collaxa.cube.engine.core.Scope.getVariantRV(Scope.java:535)
         at com.collaxa.cube.engine.CubeEngine.getFieldValue(CubeEngine.java:2668)
    For your reference the variable output is declared in the definition of AsyncCallbackImpl (which implements the IAsyncInstanceCallback interface).
    There are 2 methods defined in the AsyncCallbackImpl class.
    public void onResult(Map pResultMessage) {
    System.out.println("called back! ");
    Iterator iTest = pResultMessage.keySet().iterator();
    while (iTest.hasNext()) {
    String key = (String)iTest.next();
    System.out.println(XMLHelper.elementToString((Element)pResultMessage.get(key)));
    public String getVariableName() {
    return "output";
    The variable name is same given in the sample code. And the BPEL process returns variable named output. So the name should not be a problem.
    Is it because of the scope of the variable.. If so, how do I change it.
    Any help would be appreciated.
    Edited by: saptarishi on May 25, 2010 4:24 PM
    Edited by: saptarishi on May 26, 2010 4:45 PM

    Solved it by some googling .... :)
    Here is the link:-
    [http://abhishek-soablog.blogspot.com/2008/09/orabpel-02118.html]
    or
    [http://beautifulwaste.blogspot.com/2008/04/calling-asynchronous-bpel-process.html]
    Both gives the same solution..
    In pre 10.1.3.3 release the default behaviour were to keep global variable information along with the instance information for completed BPEL processes.
    In 10.1.3.3 or later, this behaviour changed for performance reasons so that the default behaviour is now, not to keep any global variables for a BPEL process once the BPEL process has completed.
    You can configure this behaviour on a process level basis by using the parameter keepGlobalVariables in the bpel.xml file for the specific process:
    <BPELSuitcase>
    <BPELProcess src=".........." id="...........">
    <configurations>
    <property name="keepGlobalVariables">true</property>
    </configurations>
    </BPELProcess>
    </BPELSuitcase>
    Thanks
    saptarishi

  • Getting windows services through java

    Hi,
    I just want to get the status of windows services( SERVICE_NAME: DWMRCS)
    and also i have to stop and start the services through java code is there any help?
    thanks

    Use "sc" util with Runtime.exec().

  • Problem with executing shell script on linux through java code.

    i am facing problem to kill jboss process on linux that is my application requirement. for that i created one shell script that will get all the process for jboss instance and kill them when i am running that script from command prompt on linux its working perfectly.
    The command i am using ---
    /opt/RW9/jboss/v4.0.5.GA/bin/restartjboss.sh.
    but when i am running through java code its not working.
    the java code i am using is:-
    pp = Runtime.getRuntime().exec(new String[]{"/bin/sh", "-c", "/opt/RW9/jboss/v4.0.5.GA/bin/restartjboss.sh"});
    could anyone tell me what is the problem ?
    Edited by: akm198110 on Sep 2, 2008 9:24 AM

    I got the problem after long struggle ,after doing proper path i am able to execute the shell script..

  • Setting java_home through java code

    Hello , i went through lots of information for setting java_home through java code but i was unable to find any useful information, does anybody know how to set java home through java code
    Regards
    Mayur Mitkari

    The question doesn't make any sense to me. If Java needs the JAVA_HOME variable set, how is it ever going to execute any code that does so? And if it doesn't need it, why set it?

  • Change the Summary Attribute Value through Java code

    Hi ,
    I am working on a requirement where I need to set the Attribute value on the final Summary Screen through Java Code.
    Code :
            InterviewUserData data = new InterviewUserData();
            InterviewEntityInstance globalInstance = data.getGlobalInstance();
            globalInstance.setValue("Name", value_to_set);
    On completion of the interview session Name is displaying as NULL.
    I need to set NAME = value_to_set and display it on the final summary screen.
    Any help on this will be appreciated.
    Regards

    The InterviewUserData object is effectively a change set, to apply this to a session you use the InterviewSession.submit(InterviewUserData) method. You don't say how you are invoking this code but if it's inside an event Interview Engine handler the InterviewSession object should be accessible.
    Regards
    Ian

  • How to update OID oblogintrycout attribute through java code

    Hi Team,
    As per my requirement ,i need to update OID oblogintrycout attribute through java code. could you please help me on this.
    where can i get the java code.
    Regards,
    Ravi.

    As always, Google is your friend.
    Follow the bouncing link.
    http://www.google.com/search?hl=en&q=VisualSourceSafe+%2B+Java+API
    PS.

  • Getting the final result of BPEL Process through Java

    I am trying to invoke BPEL Process from Java code as follows:
    NormalizedMessage res=deliveryService.request("BPELProcess1", "process", nm);
    Map payload = res.getPayload();
    System.out.println("size=="+payload.size());
    Element e = (Element)payload.get("payload");
    Node node = e.getFirstChild();
    NodeList list = e.getChildNodes();
    for(int k=0;k<list.getLength();k++){
    Node n= list.item(k);
    System.out.println("Node-->"+n.getNodeName());
    The node names getting printed are :
    Node-->#text
    Node-->result
    Node-->#text
    When i retrieve value from these nodes using getNodeValue(), it is showing null for result. However through the BPEL Console, when i see the instance, it shows the result as 5 :
    <outputVariable>
    <part xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="payload">
    <BPELProcess1ProcessResponse xmlns="http://xmlns.oracle.com/BPELProcess1">
    <result>5</result>
    </BPELProcess1ProcessResponse>
    </part>
    </outputVariable>
    Any comments on this will help a lot. Thanks

    Does this example helps you:
    http://orasoa.blogspot.com/2007/06/calling-bpelesb-webservice-from.html

  • Ttrigger Event Sub-Process from Java code.

    Hi All,
    Is there any way to trigger Event Sub-Process from Java code.
    My requirement is to trigger an Event SubProcess when a Approver clicks on REJECT button in HUMAN TASK.
    One way of achieving this is by placing a gateway after the human task and by validating the human task outcome and there by triggering a call to Event SubProcess.
    But we dont want to put a gateway after the human task. But instead we would like to trigger the Event SubProcess from the ADF task forms itself. ie, by calling a JavaCode.
    Please give me some pointers on achieving this task.
    Thanks
    Parker.

    Hi  jtahlborn, mohan
    yes the process is created from my java code. 
    in my code iam creating a process like below and if it is running for a long i need to kill it from java.
    For that " Runtime.getRuntime().exec("taskkill /F /PID " +  7408); " is working fine.
    7408 is my process id in taskmgr created from java and iam manually passing the PID it to kill it.
    But i need to get the PID from java code.
    Thanks for your suggestions.
    Sample Code:
    public static void main(String args[])
            try {
              Process process = Runtime.getRuntime().exec(new String[]{"cmd.exe","/c","start"});        
              Field f = process.getClass().getDeclaredField( "handle");
              f.setAccessible( true);         
              long procHandle = f.getLong( process);
              System.out.println( "prochandle: " + procHandle );
              //Runtime.getRuntime().exec("taskkill /F /PID " +  procHandle);
            } catch( Exception e) {
              e.printStackTrace();

Maybe you are looking for

  • Maverick HP Officejet Pro 8500 Wireless - Scan is black after saving

    it seems to be a common issue that after a major release upgrade the same issues come up again which are already solved in former releases. It's a pity that there is no learning effect. After my upgrade to Maverick the Wireless AnyConnect VPN didn't

  • HP Photosmart C 4480, Snow Leopard and most recent driver problem?

    I have followed the posts regarding problems with various HP printers since the update to Snow Leopard. I removed all the HP software, went to http://support.apple.com/kb/HT 3669 and confirmed that my Photosmart Printer is included. I downloaded the

  • Web Analysis Studio. Error in report that uses dimension that was deleted.

    Hi, everyone. Firstly I created a web analysis document. Then i deleted one dimension from the cube outline. And when I run the report I ve got an error like this: [1033] Native: 502 Invalid object file specified App\TEST\Cube\TST_C\Category Please a

  • Error oracle.classloader.util.AnnotatedNoClassDefFoundError when using fop?

    Hallo, i want to use fop in my project. Doing this i've got: XML-25017 ... oracle.classloader.util.AnnotatedNoClassDefFoundError: Missing class: org.apache.fop.apps.Driver Dependent class: oracle.xml.xsql.serializerse.XSQLFOPSerializer Loader: adf.or

  • Error while POF serialization

    Hi i am getting the following error while doing the POF serialization. please help java.lang.StackOverflowError at com.tangosol.io.pof.PofBufferWriter$UserTypeWriter.isEvolvable(PofBufferWriter.java:2753) at com.tangosol.io.pof.PofBufferWriter$UserTy