File shortcut in Java

1.2k views Asked by At

I have a program which is build like this.

src 
 folder
  default package
   .java files

testfiles_folder

Is there a way to access the files in the testfiles_folder but without the absolute path because that is not the same on every computer that I will send this program?

I'm looking for something like this:

String file_directory = "testfiles_folder/testfileN.txt";

where N = 1, 2, ...

1

There are 1 answers

0
W vd L On

Use system paths.

Java 8 example:

System.getProperty("user.home");

source: System Paths