I would like to use the rar.exe
path in Java. This is needed to unpack rar files from within my Java application without using a library.
I figured I'd require the user to add the program files folder for Winrar to the PATH
system variable.
All I need to know now is how to get the full path to the rar.ex
e file.
What I've got now is this:
//Split all paths
String[] paths = System.getenv("Path").split(";");
for(String value : paths)
{
if(value.endsWith("Winrar"))
System.out.println(value);
}
However, there is no way of me knowing if the user installed Winrar to say C:\Programfiles\Winrarstuff
. Is there a way to get the location of rar.exe
, or do I have to manually scan every folder in the Path string for the location?