This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
In standalone environments (tests and when using NetBeans JARs without runtime container) it is not particularly easy to convince Lookup.getDefault() to include some folder from system file system. This needs a lot of coding and is tricky as the calls during initialization like to cause stack overflow. It is desirable to have more easier way to integrate Lookup.getDefault() with SFS when both these JARs are on classpath. Ideally things could start to work automatically, just by including these JARs on classpath. The Services folder from SFS would then become part of Lookup.getDefault() automatically. However I am afraid that this might be incompatible change. Given my 6.7 release struggle with changing MockLookup.setLookup to also include content of Services folder, which rendered horribly incompatible, I am not sure we want to risk that again. That is why I am proposing to define new property "org.openide.util.Lookup.paths" that anyone can set to "Services" and get the standard (in NetBeans Runtime Container) integration between Lookup.getDefault() and SFS.
Created attachment 83352 [details] The changes in openide.util and openide.filesystems
[JG01] Typo: "propert" [JG02] Suggest named constant in Lookup.java rather than a magical system property name defined in arch.xml where no one will be looking for it. Or better yet, public static void includeConfigPaths(String... paths) throws IllegalStateException; which would be easier to use and have the benefit of throwing an exception if you accidentally called it after Lookup.getDefault() (or this same method) had already been called.
Re. JG02: We can add such field or method anytime later if found necessary. Right now, when vast majority of the Lookup users need just Lookup.getDefault() and does not care about here in proposed functionality (as it works from them in NetBeans by default), it is not wise to distract them. Re. JG01: Thanks, I'll fix it.
I will address JG01 and integrate tomorrow.
core-main#818470e34c19
Integrated into 'main-golden', will be available in build *200906200201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/818470e34c19 User: Jaroslav Tulach <jtulach@netbeans.org> Log: #166782: org.openide.util.Lookup.paths property
*** Bug 194703 has been marked as a duplicate of this bug. ***