我不認爲有一個簡單的方法來做到這一點,但我知道你可以從檢查系統環境屬性
-- listing properties --
java.util.logging.config.file=/home/willie/.netbeans/7.0/apache-tom...
user.dir=/home/willie/apache-tomcat-7.0.14/bin
java.runtime.version=1.6.0_26-b03
java.awt.graphicsenv=sun.awt.X11GraphicsEnvironment
java.endorsed.dirs=/home/willie/apache-tomcat-7.0.14/end...
os.arch=amd64
java.io.tmpdir=/home/willie/.netbeans/7.0/apache-tom...
java.naming.factory.url.pkgs=org.apache.naming
os.name=Linux
sun.jnu.encoding=UTF-8
java.library.path=/usr/lib/jvm/java-6-sun-1.6.0.26/jre/...
tomcat.util.scan.DefaultJarScanner.jarsToSkip=bootstrap.jar,commons-daemon.jar,tomc...
java.specification.name=Java Platform API Specification
java.class.version=50.0
sun.management.compiler=HotSpot 64-Bit Tiered Compilers
os.version=2.6.38-8-generic
user.home=/home/willie
user.timezone=Africa/Johannesburg
catalina.useNaming=true
java.awt.printerjob=sun.print.PSPrinterJob
java.specification.version=1.6
file.encoding=UTF-8
catalina.home=/home/willie/apache-tomcat-7.0.14
user.name=willie
java.class.path=/home/willie/apache-tomcat-7.0.14/bin...
java.naming.factory.initial=org.apache.naming.java.javaURLContext...
sun.security.krb5.debug=false
package.definition=sun.,java.,org.apache.catalina.,org.a...
java.vm.specification.version=1.0
sun.arch.data.model=64
java.home=/usr/lib/jvm/java-6-sun-1.6.0.26/jre
sun.java.command=org.apache.catalina.startup.Bootstrap...
catalina.base=/home/willie/.netbeans/7.0/apache-tom...
file.separator=/
java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport...
common.loader=${catalina.base}/lib,${catalina.base}..
您可以檢查Tomcat的/碼頭/ JBoss的標識tomcat的...具體條目並確定版本和服務器的意思
不是一個真正的答案,但它似乎你將能夠檢查一些配置文件的物理文件路徑,它會告訴你這是在/ etc/tomcat7.0或任何地方安裝。我確信有更多的編程方式,但這對我來說似乎是合理的。 – corsiKa