Hi, An alternative is to read the artcile at http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html I did and implemented the example code with very few changes extending ScheduledJob to have a scheduable command line.
David -----Original Message----- From: Eric Pugh [mailto:[EMAIL PROTECTED]] Sent: 17 May 2002 17:01 To: 'Turbine Users List' Subject: RE: Runtime.exec() doesn't work I dont' quite understand the signedjar stuff? Isn't this in a serverside application? At any rate, I went through a similar nightmare on NT.. Turns out that if my app is running in turbine as part of Tomcat running as an NT service, then all my commands need a "cmd /c dir" before them. Not running as NT Service, then "dir" would work! Also, I had to make Tomcat run not as the localsystem, but a network account with better permissions. I know you are on linux, but hopefully this might give you ideas! Also, I copied from some great code from cruisecontrol's Ant interface class to get back output: import net.sourceforge.cruisecontrol.util.StreamPumper; <snip> Process p = Runtime.getRuntime().exec( getCommandLineArgs( buildProperties ) ); StreamPumper errorPumper = new StreamPumper( p.getErrorStream() ); StreamPumper outPumper = new StreamPumper( p.getInputStream() ); new Thread( errorPumper ).start(); new Thread( outPumper ).start(); InputStream input = p.getInputStream(); p.waitFor(); The StreamPumper class is available from CrusieControl's site. However, in the Jar file I downloaded, I could not find it, but in CVS it is there. Works great! Also, look at how AntServlet in the Scarab project works.. I use it as well... Eric -----Original Message----- From: Gregorio, Nelson [mailto:[EMAIL PROTECTED]] Sent: Friday, May 17, 2002 11:22 AM To: 'Turbine Users List' Subject: RE: Runtime.exec() doesn't work You need set system permission (signed jar o cab file) before to call Runtime for Explorer try { PolicyEngine.assertPermission(PermissionID.SYSTEM); PolicyEngine.assertPermission(PermissionID.EXEC); Runtime.getRuntime().exec( " command " ); } catch(Exception e) { System.out.println(" Don�t could to launch App " + pathApp); } for netscape PrivilegeManager.enablePrivilege("UniversalExecAccess"); try { Runtime.getRuntime().exec("command " ); } catch(Exception e) { e.printStackTrace(); } See more in www.jguru.com Security faq -----Mensaje original----- De: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Enviado el: viernes 17 de mayo de 2002 10:51 Para: [EMAIL PROTECTED] Asunto: RE: Runtime.exec() doesn't work Don't you need to capture the Process and then read the output from its InputStream? Jon -----Original Message----- From: Patrice Le Cozler [mailto:[EMAIL PROTECTED]] Sent: 17 May 2002 15:41 To: Turbine Users List Subject: Runtime.exec() doesn't work hi, I need to run a linux command from my Index.java file but when I write : Runtime.getRuntime().exec("rm -rf path-to-dir"); nothing happens and no Exception is thrown. what's wrong ? thanks for answers -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> ---------------------------------------------------------------------------- ------------- DISCLAIMER: This message contains proprietary information some or all of which may be confidential and/or legally privileged. It is for the intended recipient only who may use and apply the information only for the intended purpose. Internet communications are not secure and none of the companies in the British Biotech plc group accepts responsibility for any loss or damage which any person or legal entity may suffer or incur following their reliance on the contents of this message. Any views or opinions presented are only those of the author and not those of British Biotech. If you are not the intended recipient please delete this e-mail and notify the author immediately by calling ++44 (0)1865 748747; do not use, disclose, distribute, copy, print or rely on this e-mail. British Biotech Pharmaceuticals Limited Registered Office: Thames Court, Watlington Road, Oxford, Oxfordshire, OX4 6LY Registered in England and Wales No 1985479 -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
