Can't access files with a relative path when compiled into a jar

28 views Asked by At
import java.io.File;
public class Main {
    public static void main(String[] args) {
        System.out.println(new File(System.getProperty("user.dir") + "/src/FileT.txt").exists());
    }
}

Prints true when ran through the IDE

Prints false when compiled into a jar

0

There are 0 answers