가 나는 이유는 모르겠지만, 디버깅에 노력하고있는 동안, 나는 이것이 매우 이상한 찾을 경우 다음에 스킵 경우 :조건이 충족하지만
하면 이미지에서 보는 것처럼
in.readLine()
의 값은 null
이고 in.readLine() == null
은 true
입니다. 하지만 왜 그것이 if (in.readLine() == null) { ...
라인을 건너 뛰는가? 그러나 내가 줄을 266
과 267
에 놓으려고 할 때, 그 조건에 코드를 입력하고있다.
코드 : 디버거는 in.readLine()
을 평가할 때
private void startSOfficeService() throws InterruptedException, IOException {
if (System.getProperty("os.name").matches(("(?i).*Windows.*"))) {
try {
//Check if the soffice process is running
Process process = Runtime.getRuntime().exec("tasklist /FI \"IMAGENAME eq soffice.exe\"");
//Need to wait for this command to execute
int code = process.waitFor();
//If we get anything back from readLine, then we know the process is running
BufferedReader in = new BufferedReader(new InputStreamReader(process.getInputStream()));
if (in.readLine() == null) {
//Nothing back, then we should execute the process
String[] SOFFICE_CMD = { SOFFICE_SERVICE_PATH,
"-accept=socket,host=" + SOFFICE_SERVICE_HOST + ",port=" + SOFFICE_SERVICE_PORT + ";urp;",
"-invisible",
"-nologo"};
process = Runtime.getRuntime().exec(SOFFICE_CMD);
code = process.waitFor();
System.out.println("soffice script started");
} else {
System.out.println("soffice script is already running");
}
in.close();
in = null;
System.gc();
} catch(Exception e) {
e.printStackTrace();
}
}
}
고마워요! :) –