1

Today I try to install openjdk 7 on my ubuntu 18.04 system. It always install oracle-java8-installer instead openjdk 7. Please help me

apt-get install openjdk-7-jre

  • Ubuntu has removed JDK 7 from the repository. Also, it is no longer supported for any further updates. So you better install jdk8. – Kulfy Jul 10 '18 at 08:19
  • If you still want it you can download from here http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase7-521261.html – Kulfy Jul 10 '18 at 08:20
  • 1
    thanks for the answer, but I want to install openjdk, not Oracle jdk – duongtan Jul 10 '18 at 14:53
  • Why is this marked as duplicate if the suggested answer applies to a different version of Ubuntu? – mitchus Apr 20 '20 at 16:15

2 Answers2

1

Here you got a very good answer with a step-by-step instruction:
Download it here from Oracle.

zx485
  • 2,426
-1

I have installed OpenJDK 1.7 on Ubuntu 18.04

Step 1. Install OpenJDK 1.7

sudo dpkg -i https://packages.debian.org/sid/libjpeg62-turbo
sudo dpkg -i https://packages.debian.org/experimental/openjdk-7-jre-headless
sudo dpkg -i https://packages.debian.org/experimental/openjdk-7-jre
sudo dpkg -i https://packages.debian.org/experimental/openjdk-7-jdk

Step 2. Switch to OpenJDK 1.7

export PATH=/usr/lib/jvm/java-7-openjdk-amd64/bin:$PATH

Note: If you want to use javac command instead of openjdk 1.7, use below command

sudo update-alternatives --config java
Eugenio
  • 103
  • 2
  • 2
    It returns error: dpkg: error: cannot access archive 'https://packages.debian.org/sid/libjpeg62-turbo': No such file or directory dpkg: error: cannot access archive 'https://packages.debian.org/experimental/openjdk-7-jre-headless': No such file or directory dpkg: error: cannot access archive 'https://packages.debian.org/experimental/openjdk-7-jre': No such file or directory dpkg: error: cannot access archive 'https://packages.debian.org/experimental/openjdk-7-jdk': No such file or directory – 0x8BADF00D Dec 19 '19 at 05:02