Asier,

FileInputStream certainly does work for loading files outside the
classpath. It can be used to read any file in the filesystem (subject
to the O/S security policy, of course). I recommend reading JavaDocs.

Neil

On Mon, Feb 1, 2010 at 9:51 AM, Asier Aranbarri Beldarrain
<[email protected]> wrote:
> Hi Miguel:
>
> I have an issue with that solution; I need to send just two things, the
> bundle (bundleX.jar) and a config.properties file, just that. With the file
> install, wouldn't I need another .jar?
>
> Hi Jean:
>
> I don't understand that solution(sorry, newby here). Should I implement that
> code in the META-INF? How could I load it from the .java classes?
>
> Hi Neil:
>
> NewFileInputStream, getResourceasStream, ... don't work to load files from
> outside the classpath. They do work inside Eclipse-Equinox, but not when you
> export the .jar. I tested them all, I think:
>
>  -     propertiesFile.load(new FileInputStream("/config/BD.properties"));
>  -    InputStream is =
> ConfigIni.class.getResourceAsStream("/config/BD.properties");
> -     InputStream is= this.getClass().getResourceAsStream("/BD.properties");
>
> But they just load dinamically inside Eclipse.
>
> Thanks,
>
> Asier
>
> On 1 February 2010 10:41, Jean-Baptiste Onofré <[email protected]> wrote:
>>
>> Hi Neil,
>>
>> The FileInputStream() usage is correct too. I simply focus on another way
>> to do it using blueprint :)
>>
>> Regards
>> JB
>>
>> Neil Bartlett wrote:
>>>
>>> Sorry if I am missing something obvious, but what is wrong with "new
>>> FileInputStream(...)" ?
>>>
>>> Neil
>>>
>>> On Mon, Feb 1, 2010 at 9:12 AM, Asier Aranbarri Beldarrain
>>> <[email protected]> wrote:
>>>>
>>>> Hi everyone:
>>>>
>>>> I need to load a config.properties file from outside an osgi bundle and
>>>> I'm
>>>> having real issues getting it. The .properties MUST be outisde the
>>>> classpath, since it must be modified by the user( put user and password
>>>> from
>>>> mysql) and then read from the bundle (bundle.jar).
>>>>
>>>> I have no problem loading from outside with an static path or a dynamic
>>>> path
>>>> INSIDE eclipse. But when I try to load it dinamycally from the
>>>> eclipse-independent osgi, I cannot read the file.
>>>>
>>>> Is there any way to load a file outside the classpath with a .jar? I
>>>> repeat
>>>> that the .properties MUST be outside the classpath. Static paths don't
>>>> do
>>>> the work for me since I am forcing the user to put in an specific
>>>> location
>>>> and that's not acceptable(also, he's on linux and I on windows, so the
>>>> path
>>>> C:\ ... doesnt work).
>>>>
>>>> Thank you very much,
>>>>
>>>> Asier
>>>>
>>>> _______________________________________________
>>>> OSGi Developer Mail List
>>>> [email protected]
>>>> https://mail.osgi.org/mailman/listinfo/osgi-dev
>>>>
>>> _______________________________________________
>>> OSGi Developer Mail List
>>> [email protected]
>>> https://mail.osgi.org/mailman/listinfo/osgi-dev
>>
>> _______________________________________________
>> OSGi Developer Mail List
>> [email protected]
>> https://mail.osgi.org/mailman/listinfo/osgi-dev
>
>
> _______________________________________________
> OSGi Developer Mail List
> [email protected]
> https://mail.osgi.org/mailman/listinfo/osgi-dev
>

_______________________________________________
OSGi Developer Mail List
[email protected]
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to