i get cannot find symbol error in compile time

后端 未结 2 601
忘掉有多难
忘掉有多难 2021-01-29 07:16
import java.io.File;
 import java.io.BufferedReader;
 import java.io.InputStreamReader;
 import java.io.*;
 import java.io.InputStream;
 class pbdemo {

     static publ         


        
2条回答
  •  时光说笑
    2021-01-29 07:52

    You are trying to get an InputStream from a ProcessBuilder and that's wrong.

    ProcessBuilder.start() returns a Process object, and that's the one who has a getInputStream() method.

    Try switching that line for this one.

    BufferedReader br=new BufferedReader(new InputStreamReader(pb.start().getInputStream()));

    Or

    Process pro = pb.start();
    BufferedReader br=new BufferedReader(new InputStreamReader(pro.getInputStream()));
    

提交回复
热议问题