I'm not sure I fully understand your issue, though I'd strongly advice
against your idea of using the "relative" path approach from a user
directory.
This is just another possible security hole you'd open there if we change
this in general, if you want to do this, it's up to you.
>From what I got of your requirement it sounds to me like you should work
with properties like karaf itself does.
Set a system property add it to karaf like user.home and use it in your
scripts.

regards, Achim

2014-10-08 2:33 GMT+02:00 thully <[email protected]>:

> Hi,
>
> We have a project (Cytoscape) that uses Karaf as its shell for launching
> OSGi bundles. Anyway, when Karaf is started using the provided script
> (framework/bin/karaf and karaf.bat) we've noticed the working directory is
> changed to karaf.base before the JVM is invoked. This is done using the
> following line towards the end of the script:
>
> cd "$KARAF_BASE"
>
> Is this necessary for the proper operation of Karaf? We have several
> bundles
> that read arguments from the command line, some of which can be paths to
> local files. If a relative path is specified in one of these arguments,
> we'd
> want to look in the directory Karaf is invoked from for this file. This
> doesn't work with Karaf changing the directory - however, if we modify our
> custom Karaf distribution to not change the directory before executing, our
> bundles can reference relative paths from user-provided arguments in the
> way
> we'd expect.
>
> Obviously, everything works fine if you specify absolute paths, but that is
> undesirable for end users. And tracking the directory in our own
> environment
> variable and passing it in to every File constructor would get tedious.
>
>
>
> --
> View this message in context:
> http://karaf.922171.n3.nabble.com/Java-working-directory-relative-file-paths-and-Karaf-tp4035678.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>



-- 

Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
blog <http://notizblog.nierbeck.de/>

Software Architect / Project Manager / Scrum Master

Reply via email to