https://www.linuxuprising.com/2019/06/new-oracle-java-11-installer-for-ubuntu.html
To use the linuxuprising method, you still need the tar.gz file.
Stackoverflow makes it sound like it can be outside the login portal of Oracle, but something changed recently...
Instead, this page helped...
http://bugmenot.com/view/oracle.com
Then go get the version you want.
https://download.oracle.com/otn/java/jdk/11.0.13%2B10/bdde8881e2e3437baa70044f884d2d67/jdk-11.0.13_linux-x64_bin.tar.gz
https://download.oracle.com/otn/java/jdk/11.0.14%2B8/7e5bbbfffe8b45e59d52a96aacab2f04/jdk-11.0.14_linux-x64_bin.tar.gz
(Requires a login to oracle)
https://www.techspot.com/downloads/5553-java-jdk.html
https://files02.tchspt.com/temp/jdk-11.0.14_linux-x64_bin.tar.gz
This almost worked... the linuxuprising repo requires 11.0.13 at the time of writing, so I ended up getting that one instead from oracle. I couldn't find a mirror for it.
I downloaded both and got this:
$ md5 jdk-11*
MD5 (jdk-11.0.14_linux-x64_bin (1).tar.gz) = c2037b5f2e2a6ddcfbdfe1489bccfd63
MD5 (jdk-11.0.14_linux-x64_bin.tar.gz) = c2037b5f2e2a6ddcfbdfe1489bccfd63
After all the things above, you can just use the download link from oracle in your script. Here's my working script.
#!/usr/bin/env bash
export DEBIAN_FRONTEND=noninteractive
# set -x
cache_folder=/var/cache/oracle-jdk11-installer-local/
sudo mkdir -p $cache_folder
#url='https://download.oracle.com/otn/java/jdk/11.0.4+10/cf1bbcbf431a474eb9fc550051f4ee78/jdk-11.0.14_linux-x64_bin.tar.gz'
#url='https://download.oracle.com/otn/java/jdk/11.0.14%2B8/7e5bbbfffe8b45e59d52a96aacab2f04/jdk-11.0.14_linux-x64_bin.tar.gz'
url='https://download.oracle.com/otn/java/jdk/11.0.13%2B10/bdde8881e2e3437baa70044f884d2d67/jdk-11.0.13_linux-x64_bin.tar.gz'
wget --no-check-certificate -c --header "Cookie: oraclelicense=accept-securebackup-cookie" "$url"
sudo cp $(basename $url) $cache_folder
sudo apt update && sudo apt install -y software-properties-common && \
sudo add-apt-repository -y ppa:linuxuprising/java && \
sudo apt update && \
echo oracle-java11-installer shared/accepted-oracle-license-v1-2 select true | sudo /usr/bin/debconf-set-selections && \
sudo apt install -y oracle-java11-installer-local && \
sudo apt install oracle-java11-set-default-local
rm -rf $cache_folder
java -version
java version "11.0.13" 2021-10-19 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.13+10-LTS-370)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.13+10-LTS-370, mixed mode)