Tagged: #classpath

How to serve static resources in a web application

In any web application, there exists a folder named WebContent that automatically holds .class and jar files. When running a web application in eclipse or when deploying a war file to an external Tomcat, all that Tomcat needs is the WebContent folder. In this tutorial, we show 2 ways for serving static resources in a web application. 1- WebContent The standard way for...

ClassNotFoundException vs NoClassDefFoundError

ClassNotFoundException and NoClassDefFoundError occur when a required class is not found in the classpath at runtime. In this tutorial, we resolve the conflict between these 2 exceptions and explain the different scenarios of reproducing each one of them. 1- ClassNotFoundException As per java doc, this exception is thrown when trying to instantiate a class using one of these methods: forName(), findSystemClass(),...

Serve Static Resources with Spring Boot

In this tutorial we show how Spring Boot serves static resources like (html, js, css) in a web application. 1- Default path for static resources By default Spring Boot serves static resources defined under the following paths: /META-INF/resources/ /resources/ /static/ /public/ Except for index.html which is served as the root resource when accessing the root URL of a Spring Boot application,...