Question

I could understood that Desktop applications in Java doesn't have a pre-defined relative path for jar (library) files inclusions. It already have a CLASS_PATH env var.

But what I couldn't understood why EJB modules doesn't such feature... (Web App has!- throw WEB-INF/lib)

Was it helpful?

Solution

Here are two excerpts from the Java EE specification:

A JAR format file (such as a .jar file, .war file, or .rar file) may reference a .jar file or directory by naming the referenced .jar file or directory in a Class-Path header in the referencing JAR file’s Manifest file. The referenced .jar file or directory is named using a URL relative to the URL of the referencing JAR file. The Manifest file is named META-INF/MANIFEST.MF in the JAR file. The Class-Path entry in the Manifest file is of the form

Class-Path: list-of-jar-files-or-directories-separated-by-spaces

A .ear file may contain a directory that contains libraries packaged in JAR files. The library-directory element of the .ear file’s deployment descriptor contains the name of this directory. If a library-directory element isn’t specified, or if the .ear file does not contain a deployment descriptor, the directory named lib is used. An empty library-directory element may be used to specify that there is no library directory. All files in this directory (but not subdirectories) with a .jar extension must be made available to all components packaged in the EAR file, including application clients. These libraries may reference other libraries, either bundled with the application or installed separately, using any of the techniques described herein.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top