If xxcopy is installed?

Hi,

In my program, how can i understand most efficiently if xxcopy was installed on the machine or not?

[116 byte] By [acartamersoya] at [2007-11-27 10:35:49]
# 1

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

deAppela at 2007-7-28 18:37:21 > top of Java-index,Java Essentials,New To Java...
# 2

> 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?

jverda at 2007-7-28 18:37:21 > top of Java-index,Java Essentials,New To Java...
# 3

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

acartamersoya at 2007-7-28 18:37:21 > top of Java-index,Java Essentials,New To Java...
# 4

"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.

jverda at 2007-7-28 18:37:21 > top of Java-index,Java Essentials,New To Java...