0

I used the following code to install jdk 8 and to add repository

sudo apt-add-repository ppa:webupd8team/java
sudo apt-get update

After this when I try to install Java using the following command,

sudo apt-get install oracle-java8-installer

I am getting message, the code response is,

Reading package lists... Done
Building dependency tree      
Reading state information... Done
oracle-java8-installer is already the newest version (8u151-1~webupd8~0).
0 upgraded, 0 newly installed, 0 to remove and 13 not upgraded.
0

2 Answers 2

1

oracle-java8-installer is already the newest version

That's the error message that you get when you try to install the same package twice because the package is already installed. To prove it run the following command to show whether oracle-java8-installer is installed:

apt policy oracle-java8-installer  

When you tried to install oracle-java8-installer you got the following error message:

Download done.
Removing outdated cached downloads...
sha256sum mismatch jdk-8u151-linux-x64.tar.gz
Oracle JDK 8 is NOT installed.
dpkg: error processing package oracle-java8-installer (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing: oracle-java8-installer
E: Sub-process /usr/bin/dpkg returned an error code (1)

apt says that oracle-java8-installer is installed but java -version can't find java, so it must not have been installed correctly due to the sha256sum mismatch error which means that jdk-8u151-linux-x64.tar.gz was not downloaded correctly by the oracle-java8-installer script.

You might be having the same problem that others have that the oracle-java8-installer script isn't working properly: when i try to install or remove any softwares itis errer will occure please anyone help me so visit the official Oracle Java 9 website, download jdk-9.0.1_linux-x64_bin.tar.gz from there, and install it by following the instructions in this answer: How can I install Sun/Oracle's proprietary Java JDK 6/7/8 or JRE?.

4
  • yes i cheked your command.Now i do? Commented Nov 18, 2017 at 11:49
  • If apt policy oracle-java8-installer says that oracle-java8-installer is installed then you don't need to do anything. If the Candidate version of a package is newer than the Installed version then it is possible to use apt to update that package to the latest version using the command: sudo apt upgrade oracle-java8-installer
    – karel
    Commented Nov 18, 2017 at 11:52
  • But when i run java -version: The program 'java' can be found in the following packages: Commented Nov 18, 2017 at 11:56
  • How can I install Sun/Oracle's proprietary Java JDK 6/7/8 or JRE? and then set Java 8 as the default Java with the command: sudo apt install oracle-java8-set-default
    – karel
    Commented Nov 18, 2017 at 12:01
0

Another way to confirm its installed is running this command from your terminal:

 dpkg-query -l oracle-java8-installer

You should see this:

Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                               Version                Architecture           Description
+++-==================================-======================-======================-=========================================================================
ii  oracle-java8-installer             8u151-1~webupd8~0      all                    Oracle Java(TM) Development Kit (JDK) 8

The second i means its installed.

From man dpkg-query:

-l, --list [package-name-pattern...]
              List  packages  matching  given  pattern.  If  no package-name-pattern is given, list all packages in /var/lib/dpkg/status, excluding the ones
              marked as not-installed (i.e. those which have been previously purged). Normal shell wildcard characters are allowed in  package-name-pattern.
              Please  note  you  will  probably have to quote package-name-pattern to prevent the shell from performing filename expansion. For example this
              will list all package names starting with “libc6”:

                dpkg-query -l 'libc6*'

              The first three columns of the output show the desired action, the package status, and errors, in that order.

              Desired action:
                u = Unknown
                i = Install
                h = Hold
                r = Remove
                p = Purge

              Package status:
                n = Not-installed
                c = Config-files
                H = Half-installed
                U = Unpacked
                F = Half-configured
                W = Triggers-awaiting
                t = Triggers-pending
                i = Installed

              Error flags:
                <empty> = (none)
                R = Reinst-required

              An uppercase status or error letter indicates the package is likely to cause severe problems. Please refer to dpkg(1)  for  information  about
              the above states and flags.

              The  output  format  of this option is not configurable, but varies automatically to fit the terminal width. It is intended for human readers,
              and is not easily machine-readable. See -W (--show) and --showformat for a way to configure the output format.
9
  • yes i cheked your command.Now i do? Commented Nov 18, 2017 at 11:50
  • Run java -version if your still not sure if installed Commented Nov 18, 2017 at 11:51
  • when i run java -version : The program 'java' can be found in the following packages: Commented Nov 18, 2017 at 11:54
  • What happens when you do? Commented Nov 18, 2017 at 11:54
  • When i run command sudo apt-get install oracle-java8-installer then says Download done and Oracle jdk is not installed Commented Nov 18, 2017 at 11:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .