Classpath-relative URLs in CSS

Werner Lehmann lehmann at
Wed Oct 15 10:38:01 UTC 2014

Hi David,

classpath-relative URLs in CSS do not seem to work, unfortunately. For 

   -fx-background-image: url("/mint/report_16x16.png");

has no effect. Relative addressing does work. Looks to me as if there is 
a bug in com.sun.javafx.css.converters.URLConverter.resolve. Basically 
it seems to work like this:

- if url is absolute (has a scheme, e.g. http), use it verbatim
- if stylesheet url is present, use that to resolve the image url
- otherwise go to contextclassloader

I don't get to the last step because the stylesheet url in the second 
step is always present. Am I seeing things, or is there another way to 
do this?

By the way, even with relative addressing I still cannot access images 
during debugging in Eclipse if the stylesheet is in a different Eclipse 
project than the referenced image resource. This really hurts 
modularization and resource reuse (or I am forced to do this in code). 
Any idea about that?


On 01.06.2012 04:03, David Grieve wrote:
> In the current implementation, absolute paths without a scheme are
> not resolved relative to the class path. I have created RT-21967 to
> track the issue.

More information about the openjfx-dev mailing list