What difference between app-inf and web-inf folders in JavaEE applications?

Ishikawa Yoshi picture Ishikawa Yoshi · Aug 30, 2012 · Viewed 13.8k times · Source

Can you give me understanding of main difference between APP-INF and WEB-INF folders in javaEE applications.

Thanks

Answer

Sai Ye Yan Naing Aye picture Sai Ye Yan Naing Aye · Aug 31, 2012

APP-INF

In an enterprise application (EAR application) which contains many war and jars (eg.WebApp1.war, WebApp2.war, EJB1.jar and EJB2.jar.) and suppose all these Modules want to use some classes which is available as part of a Jar (common.jar). So in this case it is better to Place this jar file inside under “APP-INF” directory,that why we don't need to put the same Jar 4 times inside each and every Modules.

WEB-INF

WEB-INF is a directory that is a private area of the web application, any files under WEB-INF directory cannot be accessed directly from browser by specifying the URL.

See EAR application structure;

enter image description here