Java 8 install issues on Debian

I have Debian cloud server that I am trying to upgrade to use Java 8.

I am getting these errors but even when I try to upgrade and add the dependencies, further errors occur.

Can anyone let me know what command I can use to install Java 8 and all dependencies?


You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 java-package : Depends: debhelper (>= 9) but it is not going to be installed
                Depends: dpkg-dev but it is not going to be installed
                Depends: fakeroot
                Depends: libasound2
                Recommends: gcc but it is not going to be installed
 libc-bin : Depends: libc6 (< 2.20) but 2.27-2 is to be installed
 locales : Depends: libc-bin (> 2.27) but 2.19-18+deb8u10 is to be installed
           Depends: libc-l10n (> 2.27) but it is not going to be installed
 unifi : Depends: java8-runtime-headless
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

Open in new window

LVL 32
nappy_dThere are a 1000 ways to skin the technology cat.Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

One possible cause of unmet dependencies could be corrupted package database, and/or some packages weren’t installed properly. To fix this problem, hit Alt+Ctrl+T to open terminal and try to run one of the following commands:

sudo apt-get clean

sudo apt-get autoclean
apt-get clean clears out the local repository of retrieved package files (the .deb files). It removes everything but the lock file from /var/cache/apt/archives/ and /var/cache/apt/archives/partial/. apt-get autoclean clears out the local repository of retrieved package files, but unlike apt-get clean, it only removes package files that can no longer be downloaded, and are largely useless.

One of the most basic fixes to resolve dependencies problems is to run:

sudo apt-get -f install
The -f here stands for “fix broken”. Apt will attempt to correct broken dependencies. If you manually installed a package that had unmet dependencies, apt-get will install those dependencies, if possible, otherwise it may simply remove the package that you installed in order to resolve the problem.

Then run:
sudo dpkg --configure -a
Then run this again:
sudo apt-get -f install
How did you install in the first place. What package are you trying to install? It should be either openjdk-8-jdk or

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
nappy_dThere are a 1000 ways to skin the technology cat.Author Commented:
Thanks that was the fix :).
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.