Steve, Here's a method which should work. Make sure Tomcat's "$TOMCAT_DIR/server/lib/catalina.jar" file is in the classpath of whatever java program is executing this code! "ResourceBundle" comes from the "java.util" package.
======================================= public String getTomcatVersion() { String serverInfo = "doh!"; try { ResourceBundle bundle = ResourceBundle.getBundle( "org.apache.catalina.util.ServerInfo" ); serverInfo = bundle.getString("server.info"); } catch ( Exception e ) { // either catalina.jar is not in classpath, or Tomcat team has changed things around! } return serverInfo; } ======================================= Alternatively, you could unzip "catalina.jar" and look for this file: "./org/apache/catalina/util/ServerInfo.properties". yours, Julius Davies, Programmer, CUCBC Email: [EMAIL PROTECTED], Ph: 604.730.6385 > -----Original Message----- > From: Steve Vanspall [mailto:[EMAIL PROTECTED]] > Sent: Thursday, January 30, 2003 4:38 AM > To: Tomcat Users List > Subject: RE: Question about detecting version > > > Thanks Julius, > > That actually helps me with another problem. > > However, my main problem here is that Tomcat will not be running. > > And that the installer in not a web application running under tomcat. > > I was wondering whether tomcat keep it's version number in a > file somewhere > > Regards > > Steve Vanspall > > -----Original Message----- > From: Julius Davies [mailto:[EMAIL PROTECTED]] > Sent: Thursday, 30 January 2003 11:15 AM > To: Tomcat Users List > Cc: [EMAIL PROTECTED] > Subject: RE: Question about detecting version > > > > Hello, Steve Vanspall, > > Have you looked at any of these methods? > > class javax.servlet.ServletContext > > public int getMajorVersion() > - Returns the major version of the Java Servlet API that this servlet > container supports. > > public int getMinorVersion() > - Returns the minor version of the Servlet API that this > servlet container > supports. > > public String getServerInfo() > - Returns the name and version of the servlet container on > which the servlet > is running. > > http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/Se > rvletContext.h > tml > > Notice that the "application" variable, implicitly visible in > a jsp, is an > instance of ServletContext. > > ========================= > <html> > <body> > <%= application instanceof ServletContext %> > </body> > </html> > ========================= > > That will print "true" in the browser. > > > yours, > > Julius Davies, Programmer, CUCBC > Email: [EMAIL PROTECTED], Ph: 604.730.6385 > > > > > -----Original Message----- > > From: Steve Vanspall [mailto:[EMAIL PROTECTED]] > > Sent: Thursday, January 30, 2003 3:29 AM > > To: Tomcat Users List > > Subject: Question about detecting version > > > > > > Hi there, > > > > This may be an off-beat question. > > > > Basically I am creating an installation application for my > > software, for > > some people who are going to demonstrate it. > > > > What I want to be able to do, is detect whether the correct > version of > > Tomcat is installed on their system. > > > > The installer will only be used in a Windows NT/2000 > > environment. I being > > platform specific goes against the whole point of JAva, but > > this is a case > > where the guy doign the demo is all the way over the other > side of the > > world. Have found some classes that will read the registry in > > a Sun Java > > environment, but Tomcat only lists the version as 4.1, is > > there a way to > > tell whether it is 4.1.1x as opposed to 4.1.1y etc? > > > > Regards > > > > Steve Vanspall > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]