레지스트리에서 데이터를 가져 오려고합니다. 응용 프로그램이 디버그 모드에서 실행 중이므로 루프 변수의 값을 볼 수 있기 때문에 문제가 반복되는 동안 문제가 발생합니다. 변수는 그 마지막 null을 반환 할 때(), 당신은 물론 널 (null)이다 라인을 반환 당신이 reader.readLine에서 읽은 내용과 일치의 내용을 교체하는레지스트리에서 데이터를 읽는 것에 대해 혼란 스럽습니다.
private final String DESKTOP_PATH="\"HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\"
+ "CurrentVersion\\Explorer\\Shell Folders\" /v Desktop";
private final String REG="REG_SZ";
private final String EXACUTE_STR="reg query "+DESKTOP_PATH;
private String getDesktopPath() throws IOException {
Process p = null;
String line = null;
try {
p = Runtime.getRuntime().exec(EXACUTE_STR);
p.waitFor();
InputStream stream=p.getInputStream();
BufferedReader reader=new BufferedReader(new InputStreamReader(stream));
while((line=reader.readLine())!=null){
line+=reader.readLine();
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return line;
짐 감사합니다. 당신 말이 맞습니다. – user3733078