-
Normally try to install the
openjdk-9-jdk
package, preferably using the package managerapt
:sudo apt install openjdk-9-jdk
This will install all of its dependencies and also download the binary package file. It should be stored at
/var/cache/apt/archives/openjdk-9-jdk_9~b114-0ubuntu1_amd64.deb
now, but the file name's second half may differ in case you're having a different version.Please note that we expect this single command to fail with the error message described in the question. Ignore the error, we'll take care of that in the next steps.
-
The dependency packages were not fully configured yet because the installation of
openjdk-9-jdk
failed and got aborted. We have to do that manually now and simply trigger the configuration of all not yet configured packages:sudo dpkg --configure -a
-
Finally we install our
openjdk-9-jdk
package. Therefore we use the downloaded and cached binary package file we got in step 1. We have to add the--force-overwrite
flag to make the package manager ignore our doubly provided file and quietly overwrite it.sudo dpkg -i --force-overwrite '/var/cache/apt/archives/openjdk-9-jdk_9~b114-0ubuntu1_amd64.deb'
You may have to adapt the file name in case you're having a different version, or just use tab-completion to enter the file name: press Tab after having entered the file name up to the underscore (
...openjdk-9-jdk_
) and it should autocomplete the correct file name.