Image class and paths relative to classpath

Tom Schindl tom.schindl at
Tue Apr 24 02:49:39 PDT 2012


e(fx)clipse' preview does this already.

It simply takes the IDEs (in the case Eclipse' buildpath) and passes it
to FXML-Loader by creating an URLClassloader - draw back until Java 7
can be marked as a prereq is that you have locking problems for example
with jars because you can't release the classloader.


Am 24.04.12 11:33, schrieb Daniel Zwolenski:
> Are you saying you don't like the URL 'classpath:' notation or that you don't like classpath loading at all?
> If the former, I don't see how one notation over the other creates any implementation issues. Can you elaborate?
> If the later. Yes, you need your tool to be classpath/sourcepath aware just like an IDE. There really shouldn't be a real technical challenge on this, or any huge safety risk. It's standard Java/IDE stuff. I dont know how you'd avoid it anyway. How do you load properties files for example, or validate against the defined FXML Controller, or load custom Controls?
> On 24/04/2012, at 5:11 PM, Daniel Fuchs <daniel.fuchs at> wrote:
>> Hi guys,
>> The JavaFX SceneBuilder will be able to deal easily with absolute
>> (eg, "file:/" or "http://") URLs, as well as with relative
>> ("@...") URLs. However dealing with things like "classpath:/..."
>> will be more challenging.
>> The issue here is that 1. you need to define your classpath before
>> loading your FXML - so that the classpath:/ can be resolved, and
>> 2. since you're editing an FXML you might not have anything in
>> the classpath yet - since you might not have compiled your project
>> yet. In which case what you'd need would be a sourcepath rather
>> than a classpath.
>> Although I do agree that classpath-based loading is interesting
>> at run time - it will make it difficult to deal with the file
>> at design-time - since it requires to set up some config before
>> you can load the FXML file. At design time, there's also the risk
>> that the wrong file will be loaded - e.g. that you will load
>> the obsolete copy of the file present in the build/ directory
>> instead of loading the brand new file you just dropped in your src/
>> hierarchy.
>> On the other hand, using the @ notation usually works well both at
>> runtime and design time - which IMO makes it safer.
>> -- daniel
>> On 4/24/12 10:04 AM, openjfx-dev-request at wrote:
>>> Date: Tue, 24 Apr 2012 08:14:25 +0200
>>> From: Martin Sladecek<martin.sladecek at>
>>> Subject: Re: Image class and paths relative to classpath
>>> To: Kevin Rushforth<kevin.rushforth at>
>>> Cc: Daniel Zwolenski<zonski at>,
>>>    "openjfx-dev at"<openjfx-dev at>
>>> Message-ID:<4F9644C1.1030002 at>
>>> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>>> I checked FXML and both relative and absolute paths work well when using
>>> "@" prefix, so I don't see a problem here. I have to check CSS.
>>> -Martin

B e s t S o l u t i o n . a t                        EDV Systemhaus GmbH
tom schindl                 geschäftsführer/CEO
eduard-bodem-gasse 5-7/1   A-6020 innsbruck     fax      ++43 512 935833                      phone    ++43 512 935834

More information about the openjfx-dev mailing list