I by mistake deleted usr/share/java in ubuntu16..04. How to fix it?
By Emma Payne •
By mistake I have deleted usr/share/java. How to fix it?
11 Answer
If you had (parts of) a Java installation at /usr/share/java* that means you installed Java through the package manager. There are a few independent Java packages available in Ubuntu and I don't know which one(s) you installed because you don't tell us. However you can reinstall any package with
sudo apt install --reinstall <PACKAGE...>to restore missing or corrupted files.
You can find out which files of all installed packages ought to reside in /usr/share/java and their respective packages with:
dpkg-query -S /usr/share/javaYou can even use the result of that command to install all of the listed packages right away:
dpkg-query -S /usr/share/java | sed -e 's/:.*$//;s/, /\n/g' | xargs -rd '\n' -- sudo apt install --reinstall