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.
George Udosen
  • 36,677

2 Answers2

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?.

karel
  • 114,770
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.
George Udosen
  • 36,677