0

このプログラムに、次の場所にあるクラスファイルを実行させようとしています/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();
   }
}
4

1 に答える 1