How can i check whether a package like javax.servlet.* exists or not in my installation of java?
Check if package is present as a resource:
// Null means the package is absent getClass().getClassLoader().getResource("javax/servlet");
Alternatively, check if some class of this package can be loaded via Class.forName(...).
Class.forName(...)