shell Command execution Failing when executed from Java
问题 When I execute the below command on command line, it shows all the stored procedures and tables in the sybase DB. printf 'sp_help\ngo\n' | isql -Uxx -Pxxxx -Dxxxxx But when I do the same thing in java. This does not return any result. Can anyone tell me what is the problem with my code below: public class test { public static void main(String[] args) { String cmd = "printf "+"\'sp_help\ngo\n\'"+"| isql -Uxx -Pxxxx -Dxxxxx" ; try{ Process p; p = Runtime.getRuntime().exec(cmd); p.waitFor();