shp2pgsql, psql command not found through ProcessBuilder Java
问题 The following command works well in command line shp2pgsql -s 4326 /Users/abc.shp | psql -U user1 -h localhost -p 5432 -d postgis However when I run the following command in Java using ProcessBuilder it says command not found. Here is the code: public static void main(String arg[]) throws Exception { ProcessBuilder pb = new ProcessBuilder("/bin/sh -c shp2pgsql /Users/abc.shp | psql -U user1 -h localhost -p 5432 -d postgis"); Process p = pb.start(); showOutput(p.getInputStream(), System.out);