How to implement additional jar support if ONLY it exists

I am developing a jar library to use the utility.

I want to significantly reduce dependencies on external banners / libraries, but provide built-in support for such a library, if it exists in the class path.

For example, I want the library to provide routines that work with sleep mode; however, I do not want the application to die in error if sleeping banks are not present.

Is there any way to implement this without having to link sleeping jars to my library?

+3
source share
1 answer

Class.forName Hibernate ClassNotFoundException catch , Hibernate — , , Hibernate.

, - Hibernate (, import), , Hibernate . :

  • Hibernate, . HibernateStuff.
  • - Hibernate import.
  • Hibernate , , HibernateStuffImpl. import .
  • , Hibernate ( Class.forName), Class.forName HibernateStuffImpl, Class#newInstance, , HibernateStuff.
  • Hibernate.
  • , HibernateStuffStub, , , Hibernate , . (JVM .)

... , , , .

+6

All Articles