tags:

views:

91

answers:

2

I am invoking the command using a bash shell in linux. This command completes its operation using java class. I want to retrieve the present working directory from where the command is invoked. When I am using System.getProperty("user.dir") I am getting the path from where the java class is invoked. Can anyone help in this.

+1  A: 

You will have to pass the directory in from the shell to the JVM on the command line.

Jim Garrison
+1  A: 
new File(".")

You can then call getAbsolutePath or whatever you like.

daveb
I believe that will assume the same directory as user.dir, which the OP said was not what s/he wanted.
Jim Garrison