Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Unable to use image resources
Obviously new to Vaadin here. I am running 7.7.0. I am attempting to use the Google Maps api, and have started to implement the Google Maps Add On. I use custom images for the map markers, and the api requires that I use string URLs to the image files.
From the documentation, I understand using them as resources is the preferred method. However, my issue is even more trivial than that... it's a bit embarassing. I added the images to the src>main>webapp>VAADIN directory under a new directory, and the jetty server reads it great from the URL "VAADIN/images/" plus the name of the image file.
The error that I am getting, however, is that Eclipse cannot recompile because it cannot delete the src. So I deleted the images directory, and it compiles ok now.
So I have seen plenty of information as to where the WAR file will put the images once it is deployed on the final server, but for some reason a couple hours of Google has not shown me where in the eclipse file structure I should store custom images.
I understand this one is a trivial issue, but of course those are the ones I get stuck on. :(
Thank you for any help. :)
Found recommendations and info regarding Maven, apparently it looks in the src>main>resources directory... so I put the images there and am trying to figure out how to reference them inside the app appropriately...
You can put the files in any subdirectory inside src/main/webapp/VAADIN. For example:
And you can add a marker with something like this:
map.addMarker("DRAGGABLE: Name of the place", new LatLon( 60.442423, 22.26044), true, "VAADIN/images/markers/marker.png");
For some reason I did not get the notification that this was answered.
Obviously your solution fixed it.
I appreciate your help. And I just bought your book. Thanks for writing it. Great job on it.