title: How to rename the temp file to original text file?
body: <p>Hello my code basically <strong>delete the empty lines from txt file</strong>, but i want at the end temp file take the originals name.</p>
  
  <pre><code>    String inputFileName = "src/inware/users.txt";
      String outputFileName = "src/inware/usersT.txt";
  
      try (BufferedReader inputFile = new BufferedReader(new FileReader(inputFileName));
           PrintWriter outputFile = new PrintWriter(new FileWriter(outputFileName))) {
          String lineOfText;
          while ((lineOfText = inputFile.readLine()) != null) {
              lineOfText = lineOfText.trim();
              if (!lineOfText.isEmpty()) {
                  outputFile.println(lineOfText);
              }
          }
          inputFile.close();
          outputFile.close();
  
          inputFile.delete();
          outputFile.renameTo(inputFile);
  
      } catch (IOException ex) {
          Logger.getLogger(ManageStudentController.class.getName()).log(Level.SEVERE, null, ex);
      }
  </code></pre>
  
  <p>I try</p>
  
  <pre><code>        inputFile.delete();
          outputFile.renameTo(inputFile);
  </code></pre>
  
  <p>But is not working... Any solution??</p>