I have created a Vaadin application that tries to use the ClassResource vaadin class to load some icons along with some vaadin components but I cannot see the icons in the final application. In icons place I see a blue question mark. The application is deployed on tomcat (latest version). Here is part of the code.
IconsUI.java :
tf.setIcon(new ClassResource("email.png")); cb.setIcon(new ClassResource("note.png")); ta.setIcon(new ClassResource("document.png")); bt.setIcon(new ClassResource("ok.png")); These image files are located in the same package as the IconsUI.java class.
My web.xml is the following :
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0"> <display-name>icons</display-name> <context-param> <description> Vaadin production mode</description> <param-name>productionMode</param-name> <param-value>false</param-value> </context-param> <servlet> <servlet-name>Icons Application</servlet-name> <servlet-class>com.vaadin.server.VaadinServlet</servlet-class> <init-param> <description> Vaadin UI class to use</description> <param-name>UI</param-name> <param-value>MavenVaadinIcons.IconsUI</param-value> </init-param> </servlet> <servlet-mapping> <servlet-name>Icons Application</servlet-name> <url-pattern>/*</url-pattern> </servlet-mapping> </web-app>