0

What's the path, I have to use to read and write a File which is in the appdata?

Can I use ImageIo or do I have to use something else. And can I use BufferedReader and BufferedWriter?

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
carlos.gmz
  • 100
  • 8

1 Answers1

0

APPDATA is an environment variable in Windows, so just build your paths including that directory, which you can get via System.getenv("APPDATA").

So, for example

File imageFile = new File(System.getenv("APPDATA") + "\\whatever\\picture.jpg");
Federico klez Culloca
  • 26,308
  • 17
  • 56
  • 95
  • That works fine. Or as alternative with NIO.2: Path path = Paths.get(System.getenv("APPDATA") + "\\whatever\\picture.jpg") – alex87 Aug 18 '20 at 17:47