Unable to find file sources while loading an image

I have made a default project with the eclipse plug-in, but i don’t know where is supposed to put the file resources such as images or xml.

        Embedded image = new Embedded("logo-aviones", new ClassResource("/images/aviones.jpg", getApplication()  ));

So I don’t know where is the “images” folder. and i get an nullPointerException.

Thanks :slight_smile:

ClassResource(path , getApplication()) will start looking for files in the source folder from the same package where you have your application. ThemeResource would probably be more appropriate for images. ThemeResource looks for files within your custom theme, see
the chapter on themes
in the Book of Vaadin.

I make my own theme copying the reindeer theme on the /WebContent/VAADIN/themes/testtheme

It reeds the providen CSS, but when i made the same request that i have exposed before, I’ll get the same


The DivisorComponentes class is the one that makes the call to the image loader.

        Embedded logo = new Embedded("logo-aviones", new ClassResource("../img/aviones.jpg", getApplication()  ));

I’ve tried putting as path “/” , “…/” and whitout the slash …and i’ll get the same error.

Thanks in advance!

You don’t need to copy the entire reindeer themes folder to be able to extend it. Just create the testtheme -folder under the themes-folder (as you’ve done) and in that folder create a file called “styles.css”. That file should contain the following row, nothing else:

@import url(../reindeer/styles.css);

To access the icon, you should use the ThemeResource and not ClassResource.

Embedded logo = new Embedded("logo-aviones", new ThemeResource("img/aviones.jpg"));


Oh, and make sure you’ve called setTheme(“testtheme”) somewhere within your application class, for example in init().

Thank you very much …you have relief my headhache :smiley: