在 java 应用程序中查找 websphere 版本

Finding the websphere version in java application

找到安装在 websphere 上的 java 版本是一个很常见的问题,但是我们如何从 java 应用程序中找到 websphere 版本本身呢?我的 java 应用程序存在于同一台服务器上,请帮忙。

我知道将版本添加为环境变量并将其读取为应用程序的解决方案。但我正在寻找一种解决方案,我们不必向 WAS 添加任何内容。

使用Server MBean to programatically access product version information within your deployed application. The serverVersion attribute will provide the information you need and then some. Within a scripting environment you have a couple options involving wsadmin objects: Use the AdminTask object to access the serverVersion attribute of the server MBean; or, use the AdminControl.getNodeBaseProductVersion command. Finally, from the command line use the versionInfo command。 -问候。