Oracle java 7 Installation in Ubuntu E: Sub-process /usr/bin/dpkg returned an error code (1)

怎甘沉沦 提交于 2019-11-30 07:45:02
gihanchanuka

Please follow below steps to install oracle java:

Download the latest Java SE SDK version.

http://www.oracle.com/technetwork/java/javase/downloads/index.html

Untar the Archive:

tar -xzvf jdk-8-linux-x64.tar.gz
mv jdk1.8.0 /opt 
cd /opt/jdk1.8.0

This step registers the downloaded version of Java as an alternative, and switches it to be used as the default:

update-alternatives --install /usr/bin/java java /opt/jdk1.8.0/bin/java 1
update-alternatives --install /usr/bin/javac javac /opt/jdk1.8.0/bin/javac 1
update-alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so mozilla-javaplugin.so /opt/jdk1.8.0/jre/lib/amd64/libnpjp2.so 1
update-alternatives --set java /opt/jdk1.8.0/bin/java
update-alternatives --set javac /opt/jdk1.8.0/bin/javac
update-alternatives --set mozilla-javaplugin.so /opt/jdk1.8.0/jre/lib/amd64/libnpjp2.so

Test

To check the version of Java you are now running

java -version

Output

java version "1.8.0"
Java(TM) SE Runtime Environment (build 1.8.0-b132)
Java HotSpot(TM) 64-Bit Server VM (build 25.0-b70, mixed mode)

To check the browser plugin browse to http://www.java.com/ and click “Do I have Java?”

Ref: https://askubuntu.com/questions/437776/ubuntu-13-04-unable-to-install-jdk7

  1. install synaptic if do not install before than.
  2. open synaptic package manager.
  3. search jdk.
  4. mark for removal all jdk installed package .
  5. apply to remove.
  6. mark for installation openjdk-8-jdk.
  7. apply.
  8. N-joy.

Anzar Ansari

sudo dpkg -P oracle-java7-installer

sudo apt-get -f install

i think that your download is corrupted you have to remove the corrupted package first by code :

sudo apt-get purge oracle-java7-installer

clean your apt :

sudo apt clean

remove and reimport the ropsitory:

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

install your package again :

sudo apt-get install oracle-java7-installer

enjoy it bro ! if the problem hasn't solved try using VPN . Maybe there is a filtering between you and the oracle website

The reason is : WHY ORACLE JAVA 7 AND 6 INSTALLERS NO LONGER WORK

If you have an Oracle Support account and you really need Oracle JDK 6 or 7, you can get the installers from the WebUpd8 PPA to work by downloading the binaries and placing them in the following folder:

  • /var/cache/oracle-jdk6-installer/ for JDK 6 (you'll need version 6u45)
  • /var/cache/oracle-jdk7-installer/ for JDK 7 (you'll need version 7u80 for 32bit and 64bit or 7u60 for arm)

... and then install the oracle-java6-installer or oracle-java7-installer package.

Tried with the solution but still not working. Even when I tried to download the jdk tar from the Oracle site it still failed at around 30-50MB. Anyway I found an article which talks about it and finally got it fixed!

Oracle Adds License to oracle-java7-installer and Now It Fails (published on March 2014)

Basically the steps are similar except the last one:

sudo apt-get update
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!