1

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, ...

Hexaholic
  • 3,299
  • 7
  • 30
  • 39
Pavlos Panteliadis
  • 1,495
  • 1
  • 15
  • 25

1 Answers1

0

Use system paths.

Java 8 example:

System.getProperty("user.home");

source: System Paths

Community
  • 1
  • 1
W vd L
  • 625
  • 9
  • 26