我一直试图让这个程序运行一个位于/Library/Application Support/Adobe/Adobe PCD/cache/Main.class.
然而每次我运行下面的方法时,它都找不到指定的文件。我认为eclipse正在项目文件夹中寻找上面的文件路径。但是第一个命令似乎不起作用。谁能帮我?还有其他方法可以运行类文件吗?
static Runtime r = Runtime.getRuntime();
public static void Run() {
try {
Runtime rt = Runtime.getRuntime();
String run = "/Library/Application Support/Adobe/Adobe PCD/cache/";
String[] command = {"java -cp " + run, "java Main"};
Process pr = rt.exec(command);
BufferedReader input = new BufferedReader(new InputStreamReader(pr.getInputStream()));
String line=null;
while((line=input.readLine()) != null) {
System.out.println(line);
}
int exitVal = pr.waitFor();
System.out.println("Exited with error code "+exitVal);
} catch(Exception e) {
System.out.println(e.toString());
e.printStackTrace();
}
}