Is there programmatic way to determine which version of the java ee environment is available?
Is there programmatic way to determine which version of the java ee environment is
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There’s no standard way to do that. The closest you could do is use reflection/ClassLoader and check for specific API classes/methods that were introduced in a given Java EE version.
Off the top of my head:
javax.ejb.Singletonjavax.ejb.Statelessjavax.ejb.TimerServicejavax.ejb.MessageDrivenBeanBefore that it’s J2EE 1.2 / EJB 1.1
Though, note, if this is for Tomcat (judging by the tag), the best way is to just check
System.getProperty("tomcat.version"). You should be able to imply the servlet version based on the Tomcat version.