开发者

Check if a program is installed on a linux machine from a java applet

Hi I need 开发者_JS百科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 :)


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.


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜