If xxcopy is installed?
Hi,
In my program, how can i understand most efficiently if xxcopy was installed on the machine or not?
Hi,
In my program, how can i understand most efficiently if xxcopy was installed on the machine or not?
import java.io.File;
public class FileTest{
public static void main(String[] args){
File f = new File("c:\\test.bat");
if (f.exists()) {
System.out.println("File already there");
}
else{
System.out.println("oh nose");
}
}
}
This is the easiest example i could make, im sure you know what it does.
//edit
forgot code tag, silly me
Message was edited by:
deAppel
> Hi,
> In my program, how can i understand most efficiently
> if xxcopy was installed on the machine or not?
Why would your program need to know that?
I am writing a GUI fom xxcopy and it will be good to know if the user had installed it or not after the program starts
Message was edited by:
acartamersoy
"Installed" is kind of a foreign notion for Java. What it means for software to be "installed" is specific to the OS and the software.
You could prompt the user to tell you where it is. This is a common approach for apps that use other apps. For instance, an IDE might give you a dialog and ask you to point it to the JDK it's supposed to use.
You could search all the directories in the PATH environment variable and see if it's there.