Minhas Kamal Minhas Kamal - 1 year ago 88
Java Question

Java: Using Relative Directory Path on Windows

Is there any way to get relative path in Java for Windows, something like the Environment Variables-


Like in C using
we can do this-

char* appdataFolderPath = getenv("APPDATA");

Edit: I have tried this solution. But it does not work!

Answer Source

You can use method System.getenv. Here is how you do it:

final String value = System.getenv("APPDATA");