title: Java - How to move files using FileUtils?
body: <p>Everyone keeps saying how simple it is to move a file from point a to point b using fileutils, but I'm having lots of trouble moving a file :( </p>
  
  <p>I have a /temp/ folder in the directory wherever the .jar is located, in this temp folder I have a .txt file I want to move up a directory (so basically next to the .jar file) but I cant seem to do it?</p>
  
  <p>Here's some code, but I know its not even close:</p>
  
  <pre><code>public void replaceFile() {
      String absolutePath = getPath();
      Path from = Paths.get(absolutePath + "\\temp\\test.txt");
      Path to = Paths.get(absolutePath + "\\test.txt");
  
      try {
          FileUtils.moveFile(FileUtils.getFile(from.toAbsolutePath().toString()), FileUtils.getFile(to.toAbsolutePath().toString()));
          JOptionPane.showMessageDialog(null, "test");
      } catch (IOException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
      }
  }
  
  public String getPath() {
      File jarDir = new File(ClassLoader.getSystemClassLoader().getResource(".").getPath());
      //JOptionPane.showMessageDialog(null, jarDir.getAbsolutePath());
      return jarDir.getAbsolutePath();
  }
  </code></pre>
  
  <p>Any help is appreciated :\</p>