How to programatically check if a software utility is installed on ubuntu using Java

前端 未结 3 1644
眼角桃花
眼角桃花 2021-01-28 23:34

I am working on a Java Project for my own learning, what i have made is a class which can both read and write to external process using Runtime.getRuntime().exec(cmd);

3条回答
  •  Happy的楠姐
    2021-01-28 23:54

    In Ubuntu/Debian you can use :

    dpkg -s packagname
    

    to see if a package is installed. Then you can parse the output of the command in your app.

提交回复
热议问题