Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
嗨,我创建了一个 java swing 应用程序。如果我运行该应用程序,那么它会正常运行(创建一个框架)并且它与一个进程 ID 相关联。当该应用程序运行时,我想使用进程 ID 查看该框架
谢谢 Sunil Kumar Sahoo
Run
String pid = new BufferedReader(new InputStreamReader( Runtime.getRuntime().exec("perl -e 'print getppid()'").getInputStream() )).readLine();;
That will return the PID of the java process, but only if perl is installed