I’m having issues with JAVA versions, as application 1 does not allow JAVA 22, application 2 wants JAVA >=17 and so on. In order to keep my java versions up-to date, I d like to find all installed applications, that need JAVA.
$ pacman -Qqe
shows a list of all applications installed. The commands
$ jps -m
$ ps aux | grep java
both are listing running JAVA-applications. How (with a bash script?) can I find the installed applications, that need JAVA?
I would have made a oneliner for you but i have to catch a plane now
Generally speaking, man pacman, man expac and man grep are your friends.
Filtering the output of expac would probably be the easiest.
The real question is - why do you have such an app. If something requires old versions it is most probably an aur build - and those are not officially supported and up to you to debug.
I have no real clue about this (never used expac before but happy to know about it now), but I wonder if @Teo was thinking about using something like this
expac -Q '%r/%n %v %E' | grep java-environment
On my laptop this gives this list which does look half-way plausible for the things I have installed
Thanks a lot for all replies @Teo, @Phemisters and @cscs and a warm welcome to Phemister!
In order to see the installed applications (not the JAVA versions) I modified the command to
Unfortunately I do not understand the options, but obviously I need both: Some applications (dBeaver) showing up with both commands, others either with the first or the second.
The proposal from cscs
$ pacman -Qs java
provides a list similar to
$ expac -Q '%r/%n %v %E' | grep java
but f.e. dBeaver is not showing up here. After that
I think that -Q searches the local database and -S the sync one, so using both will be searching two databases. I don’t know for sure what local and sync mean in this context but my first guess was that local was what I had installed and sync was what was available (including things not yet installed). But as I say, I’m guessing.
Everything said, is the (more) correct way to do this. These all assume the pacman db is in sync with your FS. And don’t include downloaded files, or anything outside the package database.
But if you want to tackle this from a different angle, which is not fool-proof, and a little bit hacky.
It is trusting the file command to identify each file on your filesystem if it’s a Java source file, complied file, JARs, and others. Then I just grep for it.
This will take some time, reading every file on your root filesystem. And you will find a lot of files Manjaro puts in, especially in /usr/share, which you can just exclude.
But I thought I’d throw this out there, to use in addition to the above. To track down rogue Java files.
Indeed, pactree -r jdk-openjdk OR pactree -r jre-openjdk is all that is needed in that case.
Note that it looks for installed packages. If you directly downloaded jar files in home it is another story.