If I understood, you have two programs meaning two separatly threads. So you can access to the process list just like this:
Windows:
try {
    Process proc = Runtime.getRuntime().exec("process.exe");
    BufferedReader input = new BufferedReader(new InputStreamReader(proc.getInputStream()));
    OutputStreamWriter oStream = new OutputStreamWriter(proc.getOutputStream());
    oStream.write("process where name='process.exe'");
    String line;
    while ((line = input.readLine()) != null) { 
        if (line.contains("process.exe")) 
            return true; 
    } 
    input.close(); 
} 
catch (Exception ex) { 
    // handle error 
}
Linux:
try {
    Process p = Runtime.getRuntime().exec(new String[] { "bash", "-c", "ps aux | grep process" });
    BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));
    String line;
    while ((line = input.readLine()) != null) {
        if (line.contains("process")) {
            // process is running
        }
    }
}
catch (Exception e) {
    // handle error
}
Hope it helps.