Paul Kinnucan wrote:
> Hi all,
>
> Is there any way to set the current working directory in Java. I want to be able to
>change the beanshell's current directory to the directory of the current source
>buffer so I don't need to specify the full path of the source file to be compiled.
>The beanshell has a cd command but it does not appear to work.
>
> - Paul
I was able to successfully use the cd("/some/directory/path") command
from a bsh Interpreter prompt. Beanshell's cd() command is just a bsh
script that appears to simply set the `bsh.cwd' property, at which point
I suspect there is code in Beanshell that resets the Interpreter's
"context" to the new value of the bsh.cwd property.
I haven't looked at the elisp for the bsh interface in JDE, so I don't
know how you'd make that happen in that context. However, it seems as if
it should work by calling Beanshell's cd() command, or possibly by
setting the bsh.cwd property directly.
I did a little digging in java.io.File as well, and it does sport
"isDirectory()" methods, and allow creation of a new File object that is
actually a directory rather than a file. However, it appears as if the
actual changing of the application's cwd context is left to the
implementation itself.
cheers,
Chris