Search code examples
javawebspherewarear

usage and significance of .Classpath in Application EAR


I am currently working on an EAR application which has a WEB project and EJB project in it. To work on eclipse with local set up i do so many build path setups and all. All these buildpaths show up in .classpath of the project.

Now when i export the EAR and deploy on Server everything works on server. My doubt is how does server know about my local system paths which are present in .classpath of my project. Does it mean .classpath has no significance at runtime?

Please explain.


Solution

  • .classpath file is eclipse specific, it will not be bundled with the EAR. Eclipse uses it to set the classpath for the project.

    An EAR has a well defined structure and Servlet container understands that structure, using it's knowledge it prods around in the EAR file and extracts classes to load in the runtime.

    Obviously server doesn't have any knowledge of your local environment. An EAR (or WAR or JAR) file is a simple archive file (with some specification or the file order and all). You can unzip it using any utility (something like 7zip). Check the structure of the packed EAR, that will give you a better understanding of what goes to your server.