This post describes about check the Java, Apache-Tomcat and JBoss package version by command line.

JAVA Version:

# java -version

java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)


Apache-Tomcat Version:

You can easily check the Apache-Tomcat version using the command, just enter into apache-tomcat binary path
 
# cd  /usr/loca/tomcat/bin

By default version script is available here : version.sh, you just run that script.
 
# sh version.sh 

Using CATALINA_BASE:   /usr/local/apache-tomcat-8x/
Using CATALINA_HOME:   /usr/local/apache-tomcat-8x/
Using CATALINA_TMPDIR: /usr/local/apache-tomcat-8x//temp
Using JRE_HOME:        /usr/java/jdk1.8.0_20/
Using CLASSPATH:       /usr/local/apache-tomcat-8x//bin/bootstrap.jar:/usr/local/apache-tomcat-8x//bin/tomcat-juli.jar
Server version: Apache Tomcat/8.0.14
Server built:   Sep 24 2014 09:01:51
Server number:  8.0.14.0
OS Name:        Linux
OS Version:     2.6.32-71.29.1.el6.x86_64
Architecture:   amd64
JVM Version:    1.8.0_20-b26
JVM Vendor:     Oracle Corporation


JBoss Version:

Go to JBoss binary path,
 
# cd /usr/share/jboss-as/bin

# ./standalone.sh --version

================================
  JBoss Bootstrap Environment

  JBOSS_HOME: /usr/share/jboss-as

  JAVA: java

  JAVA_OPTS:  -server -XX:+UseCompressedOops -XX:+TieredCompilation -Xms64m -Xmx512m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true -Djboss.server.default.config=standalone.xml
=========================================================================

Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
10:47:55,516 INFO  [org.jboss.modules] JBoss Modules version 1.1.1.GA
JBoss AS 7.1.1.Final "Brontes"

or

Also, get JBoss version from boot.log
 
# /usr/share/jboss-as/standalone/log/boot.log

11:03:45,726 INFO  [org.jboss.modules] JBoss Modules version 1.1.1.GA
11:03:47,216 INFO  [org.jboss.msc] JBoss MSC version 1.0.2.GA
11:03:47,485 INFO  [org.jboss.as] JBAS015899: JBoss AS 7.1.1.Final "Brontes" starting