How to differentiate TomEE different versions using jar files?

761 Views Asked by At

I have downloaded TomEE plume 8.0.0-M2, TomEE plus 8.0.0-M2, TomEE webprofile 8.0.0-M2, TomEE microprofile 8.0.0-M2 and OpenEJB Standalone 8.0.0-M2 (from http://tomee.apache.org/download-ng.html)

I have installed all those TomEE versions and changed the name of those folders after extracting it but now, I'm not able to check which version I'm using. I have tried using tomee-catalina-8.0.0-M2.jar JAR file but it all looks same.

I just want to differentiate versions mentioned in http://tomee.apache.org/comparison.html

Note: Don't give me answers based on a random jar file present or not present in different versions of TomEE.

1

There are 1 best solutions below

4
Hash On

The difference between the versions are only in the contained numbers of libraries. Meaning, the TomEE source files will not differ at all. The installations will only have a different size of the lib folder (because of the mentioned differences in libraries).

If you have access to the directory structure, the simple solution is to check on the list of jar files. You are not interested in this method, but this is the easiest. :)

If you do not have access to the directory structure, or would like to know at runtime what kind of features are supported you could use a neat little trick to detect features and correlate those with the table provided here.

TomEE editions features

The solution itself is to ask for the classes regarding the specific features. To do so you need a list of class names with correlation to the features. After that you can use a method like this to check if the class is accessible (if you are using classpaths instead of module-path).

private boolean isClassPresent(String className){
    try {
        Class.forName(className);
        return true;
    } catch (ClassNotFoundException e) {
        return false;
    }
}

With the generated list you'll be able to guess which pre-configured version of TomEE is used.

Be careful tho, if any additional lib is added, it could mess up your calculations.