2 Replies Latest reply on May 8, 2002 10:00 AM by Joe Hu

    How to package custom libraries with EAR or EJB-JAR?

    Joe Hu Newbie

      My EJB classes depend on a separate library mylib.jar. Could someone tell me how to package this jar file along with my EJB-JAR archive or my final EAR archive?

      Thanks a lot.

      - jrookie

        • 1. Re: How to package custom libraries with EAR or EJB-JAR?
          Ken Newbie

          put mylib.jar into your ear file - either at the root, or in a sub-directory (I use library/mylib.jar), then modify the manifest file you package with your ejb to include a reference to the utility jar - something like:

          Manifest-Version: 1.0
          Class-Path: library/mylib.jar library/myotherlib.jar

          Those library jars will be available to the EJBs, and any classes in the WAR applications also ... but don't forget that the class-loader can only see "up" the tree. So a class in the EJB will be able to find a class in mylib.jar, but a class in mylib.jar won't be able to find a class that is down in one of the other class loaders (such as the web-inf/lib area of the web application).

          Hope this helps ...

          Ken

          • 2. Re: How to package custom libraries with EAR or EJB-JAR?
            Joe Hu Newbie

            Thanks for the help. I'll try as soon as I get time.

            - jrookie