Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

java Runtime.getRuntime().exec(cmd) question

  • 19-01-2006 3:45pm
    #1
    Registered Users, Registered Users 2 Posts: 4,225 ✭✭✭


    fixed it. delete thread please!


Comments

  • Closed Accounts Posts: 17,208 ✭✭✭✭aidan_walsh


    Why? In future, please leave the question, and then post the solution, allowing other people the opportunity to learn.


  • Registered Users, Registered Users 2 Posts: 4,225 ✭✭✭Scruff


    indeed. very thoughtless of me.
    Problem was I was trying to run the following command on linux through java:
    ls -f /proc/<pid>/fd
    

    the solution is to use
    exec(String cmd, String[] envp, File dir)
    which allows to specify which directory in which to run the command.
    File fd_dir = new File("/proc/" + pid + "/fd");
    Process p = Runtime.getRuntime().exec("ls -l", null, fd_dir);
    


  • Registered Users, Registered Users 2 Posts: 27,366 ✭✭✭✭GreeBo


    ewww tying a platform independent language to a particular OS ::eek:


  • Registered Users, Registered Users 2 Posts: 2,002 ✭✭✭bringitdown


    Why not use java.io?


Advertisement