Image class and paths relative to classpath

Daniel Zwolenski zonski at googlemail.com
Tue Apr 24 02:33:36 PDT 2012


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 oracle.com> 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 openjdk.java.net wrote:
>> Date: Tue, 24 Apr 2012 08:14:25 +0200
>> From: Martin Sladecek<martin.sladecek at oracle.com>
>> Subject: Re: Image class and paths relative to classpath
>> To: Kevin Rushforth<kevin.rushforth at oracle.com>
>> Cc: Daniel Zwolenski<zonski at googlemail.com>,
>>    "openjfx-dev at openjdk.java.net"<openjfx-dev at openjdk.java.net>
>> Message-ID:<4F9644C1.1030002 at oracle.com>
>> 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


More information about the openjfx-dev mailing list