I created a Process with ProcessBuilder class in Java. In ProcessBuilder, 
in process builder i opened cmd.exe,in task manager a process is opened with cmd.exe and javw.exe for running java application, i want get process id for cmd exe which was started by java ...
            Asked
            
        
        
            Active
            
        
            Viewed 1,807 times
        
    0
            
            
         
    
    
        MeenaKrishna Kurra
        
- 14
- 5
- 
                    1Why are you running cmd three times? BTW The process id is only going be the process "cmd" at the start not the others. – Peter Lawrey Aug 19 '15 at 09:23
- 
                    i need cmd.exe process id form above code.. – MeenaKrishna Kurra Aug 19 '15 at 09:33
- 
                    1The question is already answered [here](http://stackoverflow.com/questions/4750470/how-to-get-pid-of-process-ive-just-started-within-java-program) – apangin Aug 19 '15 at 10:36
- 
                    i changed Question please check it once... – MeenaKrishna Kurra Aug 19 '15 at 12:25
- 
                    `cmd` is `cmd.exe` which you mention three times. Only the first process'es PID will be available. – Peter Lawrey Aug 19 '15 at 17:33
- 
                    i am creating process there no issue with that now i want get pid for cmd.exe process .give me suggestions to get pid for cmd.exe process – MeenaKrishna Kurra Aug 20 '15 at 06:41
1 Answers
0
            
            
        The JRE's ProcessBuilder does not provide that functionality, you could try jnr-process instead.
 
    
    
        the8472
        
- 40,999
- 5
- 70
- 122