4

I have a weird problem while trying to execute a system process from within a Java program. Getting permission denied error:
java.io.IOException: Cannot run program "pwd.sh": error=13, Permission denied

Very similar to this: Permission denied error in Java for chmod command

It is working for me on one machine and not another. I have tried setting permissions to 777 on the pwd.sh file and no luck. The problem does not occur when I start the java program as 'user1', but it does occur when I start as root with 'sudo -u user1 java ...' (Which is what I ultimately need to do.)

So, any ideas what is going on? Is there a way in Eclipse to check my userid and present working directory before the program is called?

Community
  • 1
  • 1
John L
  • 397
  • 3
  • 12
  • In Java, you can get the working dir with `System.getProperty("user.dir");`. For the user name use `System.getProperty("user.name");` In Eclipse you can change the working directory in your launch configuration and the user running eclipse is also the one running your program – Guillaume Polet Apr 20 '12 at 22:14

0 Answers0