dev@glassfish.java.net

Re: What JDK installation am I using?

From: Kedar Mhaswade <Kedar.Mhaswade_at_Sun.COM>
Date: Tue, 22 Aug 2006 16:56:52 -0700

This is a need for programmatic interface
for JRE version, I believe. Fortunately, Java SE 5.0 has
a better support with JVM MBeans. Can you:
- create the AMX AppserverConnectionSource.
- get the MBeanServerConnection from it.
- invoke the RuntimeMXBean method getVmVersion().
(http://java.sun.com/j2se/1.5.0/docs/api/java/lang/management/RuntimeMXBean.html)

Will that work? (I have not tried, but see no
reason why it won't).

If this works, it is a better way to get anything
from a "running" VM. [In other words, ask VM about VM
specifics, not app server :)]

Kedar

vince kraemer wrote:
> Is there a way to determine which JDK installation the server is using?
>
> I know this is kind of knowable by parsing AS_JAVA...
>
> Is there an AMX method that exposes this to clients?
>
> Or even the 'java -version' info?
>
> Use Case:
>
> The NetBeans IDE may be running against a JDK 6 JVM. The server may be
> running against that JVM or it may be executing against a J2SE 5 JVM.
> When the server is running against a mismatched JVM revision, NetBeans
> wants to prevent Bad Things from happening. This api would be
> instrumental in providing that level of service to our users.
>
> vbk
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>