Which File path to use in order to access my images?

Attached you find a screenshot of the folder structure inside the “target” folder of my application.

There are several images inside the folder with the path:
target/classes/VAADIN/images.

I have tried accessing the images inside that folder in a thousand different ways but nothing worked.

One of the many diffferent approaches I tried was, e.g., this:

File iconFile = new File(basePathOfApplication + “/classes/VAADIN/images/nameOfFile.png”);
whereby basePathOfApplication = VaadinService.getCurrent().getBaseDirectory().getAbsolutePath();

How can I access those images ??
37702.png

I think the path in this case is relative to classpath root.

I think you use spring boot (i saw application.properties).
So you can use this:
File file = new ClassPathResource(“VAADIN/images/nameOfFile.png”).getFile();
(if your file is in src/main/resources/VAADIN/images/nameOfFile.png)

I found a solution. I put the images folder inside VAADIN/themes/valo/ and then used “ThemeResourcefile = new ThemeResource(“images/pic.png”);”