Myrdivar
Myrdivar

Reputation: 145

Check Struts presence runtime

Which is the quickest way to check the presence of Struts runtime from a Java class?

Upvotes: 2

Views: 93

Answers (2)

Peter Lawrey
Peter Lawrey

Reputation: 533790

Try loading or using a class you need. If its not there, it will throw a ClassNotFoundException or NoClassDefFoundError respectively.

Upvotes: 0

amicngh
amicngh

Reputation: 7899

As Peter mentioned you can try to load org.apache.struts.action.RequestProcessor using Class.forName("org.apache.struts.action.RequestProcessor") if it throws ClassNotFoundException then Struts is not present.

Upvotes: 1

Related Questions