using Runtime.exec() in Java
问题 What do you have to do in Java to get the Runtime.exec() to run a program that is on the path? I'm trying to run gpsbabel which I have put into the path (/usr/local/bin). public class GpxLib { public static void main(String[] args) { try { Runtime r = Runtime.getRuntime(); Process p = r.exec("gpsbabel -i garmin -f usb: -o gpx -F -"); InputStream is = p.getInputStream(); BufferedReader br = new BufferedReader(new InputStreamReader(is)); while (true) { String s = br.readLine(); if (s == null)