Checking running non java process

Hey,
i need to write a program that checks if a non-java process is still running (under windows) and to run a system command if it is not. Is there a way to check what process are still running?
Thanks

You will have to make use of native methods for that. Or use something with Runtime.exec();

Similar Messages

  • Communicating w. running (non-Java) process from Java

    I'd like to be able write a Java program that can run an instance of a text editor, say NotePad or TextPad, with some text file open (I know how to do this via the Runtime class' exec method), but then, at a later point, open some other text file in that same running instance of the text editor. This is on Windows XP btw... with Java 1.4.x
    Can this be done? Specifically can it be done in the case of NotePad or TextPad?
    If this can be done, and someone can give me some pointers on how it's done, I'd greatly appreciate it... Thanks in advance.

    You will have to make use of native methods for that. Or use something with Runtime.exec();

  • Monitoring Non Java Process

    Hi,
    i need to write a program that checks ever x seconds to see if another, non-java process is still running and if it isnt to start it. this process is started by the system on start up not by my java process is there any way to do this?
    Any help plz
    Thanks

    Yes. Go native.

  • Running non-java programs

    Is it possible to run a non-java program(i.e program off desktop ) into a JFrame. Meaning that this program will only run in the specified JFrame.

    aggie09 wrote:
    Is it possible to run a non-java program(i.e program off desktop ) into a JFrame. Meaning that this program will only run in the specified JFrame.Don't create more than one thread for the same problem/question please. Since your previous post holds a bit more information about it, please continue there:
    [http://forums.sun.com/thread.jspa?threadID=5378613]

  • Run non-Java program inside a JFrame

    A quick question, would it be possible to run a non-java application inside a JFrame? By this, I mean restrict the program to be running only inside that frame.

    You could do some of what you need using the JAWT api:
    http://download.java.net/jdk6/docs/technotes/guides/awt/AWT_Native_Interface.html
    Thanks,
    Dmitri
    Java2D Team

  • Java application running non-Java programs

    Greetings,
    I'd like to have an application start up another non-Java application. How do I do this? For example, how would I execute the following commands from a java application?
    Unix: "ls > /tmp/ls.dat"
    NT: "dir > c:\temp\dir.dat"
    TIA,
    --Paul Galvin

    You can use Runtime.exec. You'll have to do the redirection manually, by getting the Process from the exec method, opening the output stream, and writing the results to the file you want to redirect the output to. See the many posts on Runtime.exec in this and other forums.

  • Exe run during java process

    What are the names of exes' or other processes which are run during execution of any Java program on any Computer System which we can trace into Task Manager..
    Please reply

    {quote}
    The problem is that when I am entering some number and pressing the button, the ".exe" file is invoked and the process starts running, but I could not be able to see the data that is inserted into the database after the tested time of process run. I could see the data in table only when I quit my java swing application by closing the dialog.
    {quote}
    The process must issue a COMMIT before the data will be visible to ANY other session.

  • How to access another java process?

    I run two java process, A and B, any possiblity to access process A from process B?
    Process A and B are started with class's main method.
    Thanks.

    masijade. wrote:
    georgemc wrote:
    laguna8 wrote:
    Socket will not be appropriate for my case.
    My case is: I write a document editor (just like UltraEdit), after starting the editor, there is one process running, then I right click a file and choose to open that file with my editor, it starts another editor process. What I want now is just to open that file with the editor that has already run.Don't see why sockets aren't appropriate there. Why did you dismiss them?Because he wants a single pre-finished method call answer, maybe? ;-)Teh Codez!! Indeed. It's pretty obvious that there's an entire subsection of forum users who automatically dismiss any reply which doesn't include code. If we produce an exhaustive list of all the methods by which IPC can be achieved, however archaic, he'll dismiss the lot, and then spend the rest of his life pondering this simple problem

  • Ps -p running very slow (1-2 seconds) on Java process

    Hi Solaris gurus:
    I encountered a issue that running ps -p on java process running very slow, it took almost 2 seconds to complete.
    I issued a truss on the "ps -p " command, the following is part of the output:
    /1: 0.0001 fstat(1, 0xFFFFFFFF7FFFE1F0) = 0
    /1: 0.0000 write(1, " U I D P".., 55) = 55
    /1: 0.0002 open("/proc/19299/psinfo", O_RDONLY) = 3
    */1: 1.3170 read(3, "02\0\0\0\0\0\011\0\0 K c".., 416) = 416*
    /1: 1.2401 close(3) = 0
    /1: 0.0002 stat("/dev/tty", 0xFFFFFFFF7FFFE830) = 0
    It seems that the read() spent the most time.
    Anyone can help?

    Not enough memory, page-outs is too large
    8.91 GB    Page-outs
    After removing adware, and do a safe boot of Safari and remove extensions, then reset cache history etc. You need to do a boot into Recovery Mode and run Disk Repair from there. Also boot the system in Safe Mode.
    On startup it sounds like you have a problem with the directory which would also account for long startups and checking the directory. Along with or instead of DU Repair Disk you can use Single User Mode and fsck -fy to try to fix the directory but in some cases that may not be enough.
    Backups from before you got this adware and problems helps and should always be ready and able to restore a system from known good backups or system restore image.
    4GB of RAM may have been fine originally but "Early 2011" is now 5 years and 4 OS version changes. You can upgrade the memory and while at it consider a nice SSD internal drive which will help as well. Take a look and see what prices and options there are from http://www.macsales.com for your 2011 MacBook Pro.
    http://www.everymac.com
    Community for MBP MacBook Pro

  • How to check actual allocated and used memory for java process in solaris?

    Hi,
    I'm testing performance for java application on solaris 10. And I would like to know how to measure actual memory allocated and used for java process.
    I'm setting -Xms512m -Xmx512m for my java process and I use prstat command to monitor it's memory. But I found that when I run prstat to check, in SIZE column is more than I setting (found 644).
    So I'm don't know the actual memory that java process used. (In this case,is it mean the process use memory (644) more than setting (512)?)
    Thank you.

    With Xms/Xmx you specify the Java heap size. On top of that comes the permanent generation (default max size 64m) and the C part of the process (the JVM itself with all its libraries and data).
    With "ps -e -o pid,vsz,rss,args" you get the virtual and set resident size of your processes.
    Nick.

  • J2EE:some java processes running

    HI!
    I have a general question regarding the SAP Solution Manager.
    We have succesfully installed SAP SOLMAN 4.0 (Windows, Oracle).
    Unfortunately when I start SAP system with MMC-Console, I see that the Java-instance is yellow.
    (disp+work.exe --> tells, J2EE:some java processes running).
    I cann log on to the system, but it scares me a lot (in Tr. SICK are no errors).
    <b>Can some one tell, wheter it is critical and how can I solve this problem?</b>
    Thank you!
    regards

    it seems, that your j2ee engine is not coming up correctly.
    Check note 943498  (and also see other relevant notes in Note 724452 - Central Note for SAP NetWeaver Java Server 04/2004s)
    Markus

  • Getting while running the BPEL process from java

    Hi All,
    We are using the following java code to run the BPM process.
    package callBPMProcess;
    import java.util.Hashtable;
    import java.util.UUID;
    import java.util.List;
    import javax.naming.Context;
    import oracle.soa.management.facade.Locator;
    import oracle.soa.management.facade.LocatorFactory;
    import oracle.soa.management.facade.Composite;
    import oracle.soa.management.facade.Service;
    import oracle.soa.management.facade.CompositeInstance;
    import oracle.soa.management.facade.ComponentInstance;
    import oracle.fabric.common.NormalizedMessage;
    import oracle.fabric.common.NormalizedMessageImpl;
    import oracle.soa.management.util.CompositeInstanceFilter;
    import oracle.soa.management.util.ComponentInstanceFilter;
    import java.util.Map;
    import javax.xml.transform.*;
    import javax.xml.transform.dom.*;
    import javax.xml.transform.stream.*;
    import org.w3c.dom.Element;
    import java.io.*;
    public class StartProcess { 
    public StartProcess() { 
    super();
    Hashtable jndiProps = new Hashtable();
    jndiProps.put(Context.PROVIDER_URL, "http://ytytry.4234434.com:7001/soa-infra");
    jndiProps.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
    jndiProps.put(Context.SECURITY_PRINCIPAL, "weblogic");
    jndiProps.put(Context.SECURITY_CREDENTIALS, "funnyj0ke");
    jndiProps.put("dedicated.connection", "true");
    String inputPayload =
    "<process xmlns=\"http://xmlns.oracle.com/HelloWorld/Helloworld/BPELProcess1\">\n" +
    " <input>hello</input>\n" +
    "</process>\n" ;
    Locator locator = null;
    try { 
    // connect to the soa server
    locator = LocatorFactory.createLocator(jndiProps);
    String compositeDN = "default/Helloworld!1.0";
    // find composite
    Composite composite = locator.lookupComposite("default/Helloworld!1.0");
    System.out.println("Got Composite : "+ composite.toString());
    // find exposed service of the composite
    Service service = composite.getService("bpelprocess1_client_ep2");
    System.out.println("Got serviceName : "+ service.toString());
    // make the input request and add this to a operation of the service
    NormalizedMessage input = new NormalizedMessageImpl();
    String uuid = "uuid:" + UUID.randomUUID();
    input.addProperty(NormalizedMessage.PROPERTY_CONVERSATION_ID,uuid);
    // payload is the partname of the process operation
    input.getPayload().put("payload",inputPayload);
    // process is the operation of the employee service
    NormalizedMessage res = null;
    try { 
    res = service.request("process", input);
    } catch(Exception e) { 
    e.printStackTrace();
    Map payload = res.getPayload();
    Element element = (Element)payload.get("payload");
    TransformerFactory tFactory = TransformerFactory.newInstance();
    Transformer transformer = tFactory.newTransformer();
    transformer.setOutputProperty("indent", "yes");
    StringWriter sw = new StringWriter();
    StreamResult result = new StreamResult(sw);
    DOMSource source = new DOMSource(element);
    transformer.transform(source, result);
    System.out.println("Result\n"+sw.toString());
    System.out.println("instances");
    CompositeInstanceFilter filter = new CompositeInstanceFilter();
    filter.setMinCreationDate(new java.util.Date((System.currentTimeMillis() - 2000000)));
    // get composite instances by filter ..
    List<CompositeInstance> obInstances = composite.getInstances(filter);
    // for each of the returned composite instances..
    for (CompositeInstance instance : obInstances) { 
    System.out.println(" DN: " + instance.getCompositeDN() +
    " Instance: " + instance.getId() +
    " creation-date: " + instance.getCreationDate() +
    " state (" + instance.getState() + "): " + getStateAsString(instance.getState())
    // setup a component filter
    ComponentInstanceFilter cInstanceFilter = new ComponentInstanceFilter();
    // get child component instances ..
    List<ComponentInstance> childComponentInstances = instance.getChildComponentInstances(cInstanceFilter);
    // for each child component instance (e.g. a bpel process)
    for (ComponentInstance cInstance : childComponentInstances) { 
    System.out.println(" -> componentinstance: " + cInstance.getComponentName() +
    " type: " + cInstance.getServiceEngine().getEngineType() +
    " state: " +getStateAsString(cInstance.getState()) 
    System.out.println("State: "+cInstance.getNormalizedStateAsString() );
    } catch (Exception e) { 
    e.printStackTrace();
    private String getStateAsString(int state)
    // note that this is dependent on wheter the composite state is captured or not
    if (state == CompositeInstance.STATE_COMPLETED_SUCCESSFULLY)
    return ("success");
    else if (state == CompositeInstance.STATE_FAULTED)
    return ("faulted");
    else if (state == CompositeInstance.STATE_RECOVERY_REQUIRED)
    return ("recovery required");
    else if (state == CompositeInstance.STATE_RUNNING)
    return ("running");
    else if (state == CompositeInstance.STATE_STALE)
    return ("stale");
    else
    return ("unknown");
    public static void main(String[] args) { 
    StartProcess startUnitProcess = new StartProcess();
    But we getting the fallowing error.Can some body help out us.
    SEVERE: Failed to create a DirectConnectionFactory instance (oracle.soa.api.JNDIDirectConnectionFactory): oracle.soa.api.JNDIDirectConnectionFactory
    javax.naming.NoInitialContextException: Cannot instantiate class: weblogic.jndi.WLInitialContextFactory [Root exception is java.lang.ClassNotFoundException: weblogic.jndi.WLInitialContextFactory]
         at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:657)
         at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
         at javax.naming.InitialContext.init(InitialContext.java:223)
         at javax.naming.InitialContext.<init>(InitialContext.java:197)
         at oracle.soa.management.internal.ejb.EJBLocatorImpl.<init>(EJBLocatorImpl.java:166)
         at oracle.soa.management.facade.LocatorFactory.createLocator(LocatorFactory.java:35)
         at callBPMProcess.StartProcess.<init>(StartProcess.java:53)
         at callBPMProcess.StartProcess.main(StartProcess.java:152)
    Caused by: java.lang.ClassNotFoundException: weblogic.jndi.WLInitialContextFactory
         at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
         at java.lang.Class.forName0(Native Method)
         at java.lang.Class.forName(Class.java:247)
         at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:46)
         at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:654)
         ... 7 more
    Process exited with exit code 0.
    Thanks in advanced,
    Narasimha.
    Edited by: parker on Mar 27, 2011 11:55 PM

    Looks like you don't have WebLogic classes on the classpath:
    javax.naming.NoInitialContextException: Cannot instantiate class: weblogic.jndi.WLInitialContextFactory [Root exception is java.lang.ClassNotFoundException: weblogic.jndi.WLInitialContextFactory]
    Other options for creating an instance are to use a web service call or one of the other adapters (e.g. JMS). If you need to directly start a process you might also look at this blog from the ATeam:
    http://redstack.wordpress.com/worklist/
    The specific example for getting the tasks is at: http://redstack.wordpress.com/2011/03/09/implementing-task-initiation/
    Then the real work of creating an instance from the initiator tasks is at: http://redstack.wordpress.com/2011/03/09/creating-the-domain-layer-for-the-worklist/

  • Java code running as background process in Linux causes high CPU util.

    I'm running a piece of java code as a background process in Redhat 7.1 . When I specify to run it as a background process (using the '&') at the command line, I get CPU utilization at around 5% and it dips.
    When I edit the script that runs the java code to specify running it as a background process withint the script itself (java ..... &) and then go to the command line and run the script, the CPU utilization shoots up to 95% and stays at the low 90's - very high 80's range for the CPU utilization..
    I'm hoping someone has any idea for this behavior and a way to fix it.
    Thanks in advance,
    Sarat..

    This is an interesting post and i'm sory i don't have time to
    experament before i answer
    you could of course run the script as background
    *.sh &
    but that's probubly not what you want
    I think the solution lies in giving the
    proccess a job number %n
    then setting it %n &
    it might even work to
    put something like %java &
    Anyway when it's running fullout
    it is because it is in the
    current terminal process group PID.
    wish i could help more

  • Running Java process in Back ground

    We have a script that starts a Java process in Background. But still if I try to exit from the 'Console', it's not allowing me to do so, and if I forcibly kill the console, it's killing my Java process. My question is, how can I make my java process to run completely in background? Secondly, will the JVM have any references to the console through which it is being called. Please help me.

    Hi Sastry66,
    If your application is going to use stdout/stderr, then there may be a problem. Try to redirect stdout/stderr using shell redirections when starting your java program. You may also want to try using exec java <class-file> to start the process.
    Regards,
    SUN/DTS

  • Non-terminating Java process?

    Hi,
    I have a very memory intensive Java process. The heap grows to somewhere between 1GB and 1.2GB. Basically, when I use the -Xmx1000M option I get the java.lang.OutOfMemory Error but when I use -Xmx1200M then it runs to completion.
    When I use the option -Xmx1100M then my program doesn't give me the out of memory error but it also never finishes. I am wondering if there is some weird state that it is sitting in, like maybe there is just enough memory to load the garbage collector, but not enough to have it do anything.
    See, when I give my process the -Xmx1200M option it runs in a few hours, less than 2 hours for sure. But with the -Xmx1100M option it will stay alive for 12 hours or more but never finish.
    Any comments appreciated.
    Thanks.

    When the heap limit is met, a full gc is run. Ifthat
    doesn't free enough memory, then anOutOfMemoryError
    is thrown.
    As for the extremely long runtime given -Xmx1100M,
    I'm thinking it's sort of pinging off its ceiling,so
    to speak, and running full gc's very often.Thank you. That is the type of answer I was hoping
    to get.
    So from what you said and the fact that my program
    fails at 1GB of heap but suceeds at 1.2 GB, I infer
    the following: the heap size that my program requires
    is around 1100 MB. When it gets close to that,
    garbage collection will run but will only free enough
    to do "a little bit" of work, like create the next
    few objects, then GC needs to run again, etc.
    Basically, hardly any memory is getting freed by GC,
    , but just enough is so my program can run a tiny bit
    before GC is required to run again.
    Does that sound about right?That works.

Maybe you are looking for