Java Paths.get .... readAllBytes(path)) not working with relative path
<p>I am new to Java and trying to build an FX application. One of my function aims at replacing certain strings with others. The script works fine as long as I define the absolute path of the target file, but breaks when I work with the relative path. </p>

<p>The problem is in the method "readAllBytes", that only works with the  complete path. But I need relative path, since the folder location will vary. </p>

<p>The target file is in the project folder. Is there any other method I can use to read the file content, that does not require the absolute path?</p>

<p>Thanks a lot in advance. Below is the snippet: </p>

<pre><code>    if (checkbox.isSelected()) {
        //this works .....
        Path path = Paths.get("//home/../../../../Target.fxml")
        Charset charset = StandardCharsets.UTF_8; 
        String content = new String(Files.readAllBytes(path));
        content = content.replaceAll("text_old" , "text_new");
        Files.write(path, content.getBytes(charset));

        //this doesn't work...
        Path path = Paths.get("Target.fxml");


Caused by: java.nio.file.NoSuchFileException: Target.fxml
</code></pre>