title: Java code works on my laptop, but not on my desktop?
body: <p>I use IntelliJ. I have a class that manages student grades. It can edit files, which I have a new .temp file being written, and renamed. Then the old file gets deleted. On my laptop (mac) this works fine, but on my desktop (windows) everything works, but the old file is not deleted, and temp is not renamed.</p>
  <p>Below is my method to edit the files:</p>
  <pre><code>private static void editStuGrade() throws Exception {
      System.out.println(&quot;Enter a course grade you want to change (q1,q2,q3,mid,final): &quot;);
      String editInput = command.next();
  
      System.out.println(&quot;Enter a new score: &quot;);
      String newGrade = command.next();
  
      Path p = Paths.get(System.getProperty(&quot;user.dir&quot;),&quot;src&quot;,&quot;Assignment1&quot;, student.name + &quot;.txt&quot;);
      File inputFile = new File(p.toString());
      FileInputStream inputStream = new FileInputStream(inputFile);
      InputStreamReader inputStreamReader = new InputStreamReader(inputStream);
      BufferedReader reader = new BufferedReader(inputStreamReader);
  
      File outputFile = new File(p + &quot;.temp&quot;);
      FileOutputStream outputStream = new FileOutputStream(outputFile);
      OutputStreamWriter outputStreamWriter = new OutputStreamWriter(outputStream);
      BufferedWriter writer = new BufferedWriter(outputStreamWriter);
  
          if (editInput.equalsIgnoreCase(&quot;q1&quot;)) {
              writer.write(student.name + &quot;,&quot; +  student.id + &quot;,&quot; + newGrade + &quot;,&quot; + student.quiz2
                      + &quot;,&quot; + student.quiz3 + &quot;,&quot; + student.midterm + &quot;,&quot; + student.finalTest);
              writer.close();
          } else if (editInput.equalsIgnoreCase(&quot;q2&quot;)) {
              writer.write(student.name + &quot;,&quot; +  student.id + &quot;,&quot; + student.quiz1 + &quot;,&quot; + newGrade
                      + &quot;,&quot; + student.quiz3 + &quot;,&quot; + student.midterm + &quot;,&quot; + student.finalTest);
              writer.close();
          } else if (editInput.equalsIgnoreCase(&quot;q3&quot;)) {
              writer.write(student.name + &quot;,&quot; +  student.id + &quot;,&quot; + student.quiz1 + &quot;,&quot; + student.quiz2
                      + &quot;,&quot; + newGrade + &quot;,&quot; + student.midterm + &quot;,&quot; + student.finalTest);
              writer.close();
          } else if (editInput.equalsIgnoreCase(&quot;mid&quot;)) {
              writer.write(student.name + &quot;,&quot; +  student.id + &quot;,&quot; + student.quiz1 + &quot;,&quot; + student.quiz2
                      + &quot;,&quot; + student.quiz3 + &quot;,&quot; + newGrade + &quot;,&quot; + student.finalTest);
              writer.close();
          } else if (editInput.equalsIgnoreCase(&quot;final&quot;)) {
              writer.write(student.name + &quot;,&quot; +  student.id + &quot;,&quot; + student.quiz1 + &quot;,&quot; + student.quiz2
                      + &quot;,&quot; + student.quiz3 + &quot;,&quot; + student.midterm + &quot;,&quot; + newGrade);
              writer.close();
          }
      inputFile.delete();
      outputFile.renameTo(new File(p.toString()));
      System.out.println(&quot;Successful.&quot;);
  }
  </code></pre>