Minhas Kamal Minhas Kamal - 5 months ago 16
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!


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

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