1

Hi I need to be able to check if a certain software is installed on the clients computer and where, in order to launch it. I found the following three posts as to how to do so on Windows and Mac but I can't seem to figure it out for Linux as there is no registry. Does any one know how this can be done on Linux?

Similar posts for Windows and Mac:
Can a Java applet open a "select directory" and write to a filesystem via JavaScript interaction?
read/write to Windows Registry using Java
How can I see the software installed in a Mac OS using a java application?

any help would be greatly appreciated :)

Community
  • 1
  • 1
  • 1
    What is the ultimate goal of launching the software? Is it to display or process a file whose file type is registered with that program as a consumer (to put that a different way; double click the file, does the program appear)? – Andrew Thompson May 03 '11 at 13:54

3 Answers3

1

Assuming your security context allows it, you could call out to which.

$ which java
/usr/bin/java

which will output nothing if the program is not found.

Andrea
  • 19,134
  • 4
  • 43
  • 65
kenm
  • 23,127
  • 2
  • 43
  • 62
1

Use the

which file

command to find out if the software is installed in the path. If that comes up with nothing then you could do a

find ./ -name "file"

Also check their local bin or .bin if its not included in the path.

fedorqui
  • 275,237
  • 103
  • 548
  • 598
Grammin
  • 11,808
  • 22
  • 80
  • 138
0

Well, basically every binary installed on Linux is in the PATH (environment variable), so if you can find it there, it's there.

There may also be software that installs into other paths, but in this case the user would need to point them out. It is a very uncommon case to have an application in a seperate path and not adding that one to PATH.

ypnos
  • 50,202
  • 14
  • 95
  • 141