使用Java或JVMTI识别当前的JVM [英] Identify the current JVM with Java or JVMTI

查看:151
本文介绍了使用Java或JVMTI识别当前的JVM的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想确定当前正在运行的JVM.最好的情况是使用 JVMTI文档,但我什么也找不到.

I would like to identify the current JVM which is run. In the best case with a function described in the JVMTI Documentation, but I cannot find anything.

我的意思是这样的:VirtualMachine.list()提供:

What I meant, is something like this: VirtualMachine.list() delivers:

[sun.tools.attach.WindowsAttachProvider@46ae506e: 2440 de.fu.profiler.view.MainFrame...

但是它将显示所有JVM,而不是当前正在运行的JVM.

But it displays all JVMs, not the current one being run.

推荐答案

您可以从

You can get a unique name from the RuntimeMXBean. on most platforms, this includes the processid of the current process.

这篇关于使用Java或JVMTI识别当前的JVM的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆