如何查看使用Java应用程序在Mac OS中安装的软件? [英] How can I see the software installed in a Mac OS using a java application?
问题描述
我正在编写一个程序,列出我的Mac中安装的所有软件.我在哪里可以找到该信息? 谢谢
Im writting a program that lists all the software installed in my mac. Where can I find that information? Thank you
推荐答案
您可以调用lsregister -dump
以获得在Launch Services中注册的所有应用程序的列表.不过,输出将需要解析;每条记录都有一个 path 属性,该属性列出了应用程序的完整路径.
You can call lsregister -dump
to get a list of all applications registered with Launch Services. The output will need to be parsed, though; each record has a path property that lists the full path to the application.
一种更简单的方法是扫描/Applications
以查找所有.app
包,以及扫描~/Applications
每个用户.不能保证该方法可以获取 all 个应用程序,但这将是一个不错的开始.
A simpler way would just be to scan /Applications
for all .app
bundles, as well as ~/Applications
for each user. That method wouldn't be guaranteed to get all applications, but it would be a pretty good start.
这篇关于如何查看使用Java应用程序在Mac OS中安装的软件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!