On Fri, Jul 16, 2010 at 8:50 PM, <glassfish_at_javadesktop.org> wrote:
> =)
> From app code of course.
> Server-side appl in the same jmv
> [Message sent by forum member 'jmichaelj']
In version 2.2.1, we load the class
com.sun.appserv.server.util.Version and call the String getVersion()
method. This is the method we use
private static final String GLASSFISH_VERSION_CLASS =
"com.sun.appserv.server.util.Version";
private static final String GET_VERSION_METHOD = "getVersion";
private static final String GET_PRODUCT_NAME_METHOD = "getProductName";
private static final Class[] NULL_PARAMS = (Class[]) null;
private void loadVersionInformation() throws
ClassNotFoundException, NoSuchMethodException,
IllegalAccessException, InvocationTargetException {
Class c =
this.getClass().getClassLoader().loadClass(GLASSFISH_VERSION_CLASS);
if (c != null) {
Method m = c.getMethod(GET_VERSION_METHOD, NULL_PARAMS);
if (m != null) {
version = (String) m.invoke(NULL_PARAMS);
}
m = c.getMethod(GET_PRODUCT_NAME_METHOD, NULL_PARAMS);
if (m != null) {
productName = (String) m.invoke(NULL_PARAMS);
}
}
}
Hope this helps,
Ed