I am trying to get some data from registry .The problem is while loop ,because when the application is running in debug mode I can view the value of a line variable .But end of the loop line variable is assigned null
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;