I have a question about the following command:
apt-cache search java | awk '{print($1)}' | grep -E -e '^(ia32-)?(sun|oracle)-java' -e '^openjdk-' -e '^icedtea' -e '^(default|gcj)-j(re|dk)' -e '^gcj-(.*)-j(re|dk)' -e 'java-common'
Owing to my limited IT knowledge, am I right to say that the (ia32-) in the above command refers to 32-bit software? If it is, then I assume that the above command is for 32-bit installed OS.
However I installed a 64-bit OS.
What is the correct parameter for 64-bit software? Is it (amd64-) or (ia-64) or (x86_64-)?
Any expert help is much appreciated.
First of all,
apt-cache search
does not search for installed packages, it looks for available ones, both installed and not installed. Also, the various search patterns you see are not mutually exclusive, so lines matching any of them will be printed. Finally, the?
after^(ia32-)
meansia32-
is optional, the expression will match lines that have it and lines that don't. So, your command will indeed work for 64 and 32 bit systems.The equivalent command to look for installed packages only would be:
But don't use that. In Debian derived systems such as Ubuntu, there is a special tool for this,
update-java-alternatives
which, when run with the-l
option will list installed Java environments:On my system, for example, this prints: