title: How to properly use Class-Path mechanism in Java EE 7 application modules
body: <p>I'm curious about how to properly use Class-Path mechanism in <em>portable</em> Java EE 7 multimodule application.</p>
  
  <p>Must EJB module reference 3rd party libraries, placed in <code>lib</code> folder of the EAR, in its MANIFEST.MF Class-Path?</p>
  
  <p>To me, it looks like explicit references to them are not needed, because Java EE specification (EE.8.4.1 "Assembling a Java EE Application", item 3.e) states:</p>
  
  <blockquote>
    <p>Make sure that each component in the application properly describes any
    dependencies it may have on other components in the application. A Java
    EE application should not assume that all components in the application
    will be available on the class path of the application at run time. Each
    component might be loaded into a separate class loader with a separate
    namespace. If the classes in a JAR file depend on classes in another JAR
    file, the first JAR file should reference the second JAR file using the ClassPath
    mechanism. A notable exception to this rule is JAR files located in the
    WEB-INF/lib directory of a web application. All such JAR files are
    included in the class path of the web application at runtime; explicit
    references to them using the Class-Path mechanism are not needed.
    Another exception to this rule is JAR files located in the library directory
    (usually named lib) in the application package.</p>
  </blockquote>
  
  <p>But I found advises to add references to 3rd party libraries to Class-Path of EJB module, when I was googling this question. And this confuses me a little bit.</p>
  
  <p>I'll appreciate any help!</p>