Install Java
Set Default Java Version
Set Default Java Version
Linux
Linux
sudo update-alternatives --config java
There are 2 choices for the alternative java (providing /usr/bin/java).
Selection Path Priority Status------------------------------------------------------------* 0 /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1111 auto mode 1 /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1111 manual mode 2 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 1081 manual mode
Press <enter> to keep the current choice[*], or type selection number: 2update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java to provide /usr/bin/java (java) in manual mode
Selection Path Priority Status------------------------------------------------------------* 0 /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1111 auto mode 1 /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1111 manual mode 2 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 1081 manual mode
Press <enter> to keep the current choice[*], or type selection number: 2update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java to provide /usr/bin/java (java) in manual mode
Install Java
Install Java
sudo apt install default-jdk
java -version
Version 17
Version 17
rpm -i /tmp/jdk-17_linux-x64_bin.rpm
java -version
Version 16
Version 16
tar xvf openjdk-16*_bin.tar.gz
There are no rules around which directory to extract this archive to. Whatever location you choose, remember to add it to your PATH.Version 11
Version 11
yum update
yum install java-11-openjdk-devel
java -version
Version 8 (1.8)
Version 8 (1.8)
sudo apt install openjdk-8-jdk
Reading package lists... DoneBuilding dependency tree... DoneReading state information... DoneThe following additional packages will be installed: libice-dev libpthread-stubs0-dev libsm-dev libx11-dev libxau-dev libxcb1-dev libxdmcp-dev libxt-dev openjdk-8-jdk-headless openjdk-8-jre openjdk-8-jre-headless x11proto-dev xorg-sgml-doctools xtrans-devSuggested packages: libice-doc libsm-doc libx11-doc libxcb-doc libxt-doc openjdk-8-demo openjdk-8-source visualvm fonts-nanum fonts-ipafont-gothic fonts-ipafont-mincho fonts-wqy-microhei fonts-wqy-zenheiThe following NEW packages will be installed libice-dev libpthread-stubs0-dev libsm-dev libx11-dev libxau-dev libxcb1-dev libxdmcp-dev libxt-dev openjdk-8-jdk openjdk-8-jdk-headless openjdk-8-jre openjdk-8-jre-headless x11proto-dev xorg-sgml-doctools xtrans-dev0 to upgrade, 15 to newly install, 0 to remove and 11 not to upgrade.Need to get 45.8 MB of archives.After this operation, 155 MB of additional disk space will be used.Do you want to continue? [Y/n] YGet:1 http://gb.archive.ubuntu.com/ubuntu jammy/main amd64 xorg-sgml-doctools all 1:1.11-1.1 [10.9 kB]Get:2 http://gb.archive.ubuntu.com/ubuntu jammy/main amd64 x11proto-dev all 2021.5-1 [604 kB]Get:3 http://gb.archive.ubuntu.com/ubuntu jammy/main amd64 libice-dev amd64 2:1.0.10-1build2 [51.4 kB]Get:4 http://gb.archive.ubuntu.com/ubuntu jammy/main amd64 libpthread-stubs0-dev amd64 0.4-1build2 [5,516 B]Get:5 http://gb.archive.ubuntu.com/ubuntu jammy/main amd64 libsm-dev amd64 2:1.2.3-1build2 [18.1 kB]Get:6 http://gb.archive.ubuntu.com/ubuntu jammy/main amd64 libxau-dev amd64 1:1.0.9-1build5 [9,724 B]Get:7 http://gb.archive.ubuntu.com/ubuntu jammy/main amd64 libxdmcp-dev amd64 1:1.1.3-0ubuntu5 [26.5 kB]Get:8 http://gb.archive.ubuntu.com/ubuntu jammy/main amd64 xtrans-dev all 1.4.0-1 [68.9 kB]Get:9 http://gb.archive.ubuntu.com/ubuntu jammy/main amd64 libxcb1-dev amd64 1.14-3ubuntu3 [86.5 kB]Get:10 http://gb.archive.ubuntu.com/ubuntu jammy-updates/main amd64 libx11-dev amd64 2:1.7.5-1ubuntu0.3 [744 kB]Get:11 http://gb.archive.ubuntu.com/ubuntu jammy/main amd64 libxt-dev amd64 1:1.2.1-1 [396 kB]Get:12 http://gb.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 openjdk-8-jre-headless amd64 8u392-ga-1~22.04 [30.8 MB]Get:13 http://gb.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 openjdk-8-jre amd64 8u392-ga-1~22.04 [75.5 kB]Get:14 http://gb.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 openjdk-8-jdk-headless amd64 8u392-ga-1~22.04 [8,863 kB]Get:15 http://gb.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 openjdk-8-jdk amd64 8u392-ga-1~22.04 [4,006 kB]Fetched 45.8 MB in 5s (8,810 kB/s) Selecting previously unselected package xorg-sgml-doctools.(Reading database ... 297432 files and directories currently installed.)Preparing to unpack .../00-xorg-sgml-doctools_1%3a1.11-1.1_all.deb ...Unpacking xorg-sgml-doctools (1:1.11-1.1) ...Selecting previously unselected package x11proto-dev.Preparing to unpack .../01-x11proto-dev_2021.5-1_all.deb ...Unpacking x11proto-dev (2021.5-1) ...Selecting previously unselected package libice-dev:amd64.Preparing to unpack .../02-libice-dev_2%3a1.0.10-1build2_amd64.deb ...Unpacking libice-dev:amd64 (2:1.0.10-1build2) ...Selecting previously unselected package libpthread-stubs0-dev:amd64.Preparing to unpack .../03-libpthread-stubs0-dev_0.4-1build2_amd64.deb ...Unpacking libpthread-stubs0-dev:amd64 (0.4-1build2) ...Selecting previously unselected package libsm-dev:amd64.Preparing to unpack .../04-libsm-dev_2%3a1.2.3-1build2_amd64.deb ...Unpacking libsm-dev:amd64 (2:1.2.3-1build2) ...Selecting previously unselected package libxau-dev:amd64.Preparing to unpack .../05-libxau-dev_1%3a1.0.9-1build5_amd64.deb ...Unpacking libxau-dev:amd64 (1:1.0.9-1build5) ...Selecting previously unselected package libxdmcp-dev:amd64.Preparing to unpack .../06-libxdmcp-dev_1%3a1.1.3-0ubuntu5_amd64.deb ...Unpacking libxdmcp-dev:amd64 (1:1.1.3-0ubuntu5) ...Selecting previously unselected package xtrans-dev.Preparing to unpack .../07-xtrans-dev_1.4.0-1_all.deb ...Unpacking xtrans-dev (1.4.0-1) ...Selecting previously unselected package libxcb1-dev:amd64.Preparing to unpack .../08-libxcb1-dev_1.14-3ubuntu3_amd64.deb ...Unpacking libxcb1-dev:amd64 (1.14-3ubuntu3) ...Selecting previously unselected package libx11-dev:amd64.Preparing to unpack .../09-libx11-dev_2%3a1.7.5-1ubuntu0.3_amd64.deb ...Unpacking libx11-dev:amd64 (2:1.7.5-1ubuntu0.3) ...Selecting previously unselected package libxt-dev:amd64.Preparing to unpack .../10-libxt-dev_1%3a1.2.1-1_amd64.deb ...Unpacking libxt-dev:amd64 (1:1.2.1-1) ...Selecting previously unselected package openjdk-8-jre-headless:amd64.Preparing to unpack .../11-openjdk-8-jre-headless_8u392-ga-1~22.04_amd64.deb ...Unpacking openjdk-8-jre-headless:amd64 (8u392-ga-1~22.04) ...Selecting previously unselected package openjdk-8-jre:amd64.Preparing to unpack .../12-openjdk-8-jre_8u392-ga-1~22.04_amd64.deb ...Unpacking openjdk-8-jre:amd64 (8u392-ga-1~22.04) ...Selecting previously unselected package openjdk-8-jdk-headless:amd64.Preparing to unpack .../13-openjdk-8-jdk-headless_8u392-ga-1~22.04_amd64.deb ...Unpacking openjdk-8-jdk-headless:amd64 (8u392-ga-1~22.04) ...Selecting previously unselected package openjdk-8-jdk:amd64.Preparing to unpack .../14-openjdk-8-jdk_8u392-ga-1~22.04_amd64.deb ...Unpacking openjdk-8-jdk:amd64 (8u392-ga-1~22.04) ...Setting up libpthread-stubs0-dev:amd64 (0.4-1build2) ...Setting up xtrans-dev (1.4.0-1) ...Setting up openjdk-8-jre-headless:amd64 (8u392-ga-1~22.04) ...update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/orbd to provide /usr/bin/orbd (orbd) in auto modeupdate-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/servertool to provide /usr/bin/servertool (servertool) in auto modeupdate-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/tnameserv to provide /usr/bin/tnameserv (tnameserv) in auto modeSetting up xorg-sgml-doctools (1:1.11-1.1) ...Setting up openjdk-8-jre:amd64 (8u392-ga-1~22.04) ...update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/policytool to provide /usr/bin/policytool (policytool) in auto modeSetting up openjdk-8-jdk-headless:amd64 (8u392-ga-1~22.04) ...update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/clhsdb to provide /usr/bin/clhsdb (clhsdb) in auto modeupdate-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/extcheck to provide /usr/bin/extcheck (extcheck) in auto modeupdate-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/hsdb to provide /usr/bin/hsdb (hsdb) in auto modeupdate-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/idlj to provide /usr/bin/idlj (idlj) in auto modeupdate-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/jar to provide /usr/bin/jar (jar) in auto modeupdate-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/jarsigner to provide /usr/bin/jarsigner (jarsigner) in auto modeupdate-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/javac to provide /usr/bin/javac (javac) in auto modeupdate-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/javadoc to provide /usr/bin/javadoc (javadoc) in auto modeupdate-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/javah to provide /usr/bin/javah (javah) in auto modeupdate-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/javap to provide /usr/bin/javap (javap) in auto modeupdate-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/jcmd to provide /usr/bin/jcmd (jcmd) in auto modeupdate-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/jdb to provide /usr/bin/jdb (jdb) in auto modeupdate-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/jdeps to provide /usr/bin/jdeps (jdeps) in auto modeupdate-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/jfr to provide /usr/bin/jfr (jfr) in auto modeupdate-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/jhat to provide /usr/bin/jhat (jhat) in auto modeupdate-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/jinfo to provide /usr/bin/jinfo (jinfo) in auto modeupdate-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/jmap to provide /usr/bin/jmap (jmap) in auto modeupdate-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/jps to provide /usr/bin/jps (jps) in auto modeupdate-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/jrunscript to provide /usr/bin/jrunscript (jrunscript) in auto modeupdate-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/jsadebugd to provide /usr/bin/jsadebugd (jsadebugd) in auto modeupdate-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/jstack to provide /usr/bin/jstack (jstack) in auto modeupdate-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/jstat to provide /usr/bin/jstat (jstat) in auto modeupdate-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/jstatd to provide /usr/bin/jstatd (jstatd) in auto modeupdate-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/native2ascii to provide /usr/bin/native2ascii (native2ascii) in auto modeupdate-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/rmic to provide /usr/bin/rmic (rmic) in auto modeupdate-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/schemagen to provide /usr/bin/schemagen (schemagen) in auto modeupdate-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/serialver to provide /usr/bin/serialver (serialver) in auto modeupdate-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/wsgen to provide /usr/bin/wsgen (wsgen) in auto modeupdate-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/wsimport to provide /usr/bin/wsimport (wsimport) in auto modeupdate-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/xjc to provide /usr/bin/xjc (xjc) in auto modeSetting up openjdk-8-jdk:amd64 (8u392-ga-1~22.04) ...update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/appletviewer to provide /usr/bin/appletviewer (appletviewer) in auto modeupdate-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/bin/jconsole to provide /usr/bin/jconsole (jconsole) in auto modeProcessing triggers for hicolor-icon-theme (0.17-2) ...Processing triggers for gnome-menus (3.36.0-1ubuntu3) ...Processing triggers for libc-bin (2.35-0ubuntu3.5) ...Processing triggers for man-db (2.10.2-1) ...Processing triggers for sgml-base (1.30) ...Processing triggers for mailcap (3.70+nmu1ubuntu1) ...Setting up x11proto-dev (2021.5-1) ...Processing triggers for desktop-file-utils (0.26-1ubuntu3) ...Setting up libxau-dev:amd64 (1:1.0.9-1build5) ...Setting up libice-dev:amd64 (2:1.0.10-1build2) ...Setting up libsm-dev:amd64 (2:1.2.3-1build2) ...Setting up libxdmcp-dev:amd64 (1:1.1.3-0ubuntu5) ...Setting up libxcb1-dev:amd64 (1.14-3ubuntu3) ...Setting up libx11-dev:amd64 (2:1.7.5-1ubuntu0.3) ...Setting up libxt-dev:amd64 (1:1.2.1-1) ...
Windows
Windows
Set JAVA_HOME System Variable in "Advanced System Settings" - "Environment Variables"
Update PATH System Variable to include %JAVA_HOME%/bin
To test... at a command prompt...
echo %JAVA_HOME%
javac -version
AIX
AIX
To check if Java is installed use:
lslpp -l | grep -i java
JAVA bundled with Oracle Database Server
JAVA bundled with Oracle Database Server
If JAVA is not installed elsewhere on your system, you may be able to utilize the bundled JAVA provided with any Oracle Database Server install.
JAVA will be installed in:
$ORACLE_HOME/jdk/bin
Bibliography
Bibliography
https://openjdk.java.net/https://openjdk.java.net/install/https://openjdk.org/install/https://www.oracle.com/java/technologies/downloads/https://www.oracle.com/downloads/licenses/no-fee-license.htmlhttps://www.oracle.com/java/technologies/jdk-script-friendly-urls/
https://phoenixnap.com/kb/install-java-on-centoshttps://javatutorial.net/set-java-home-windows-10 https://surajgyawali.com/2015/10/15/how-to-setup-ibm-java-runtime-environment-jre-and-add-jre-as-a-system-variable-on-aix-7-1/https://access.redhat.com/articles/2950741
https://www.linuxcloudvps.com/blog/how-to-install-and-manage-multiple-java-versions-on-linux/
TODO To investigate...https://docs.oracle.com/javase/8/docs/technotes/guides/deploy/self-contained-packaging.htmlhttp://java-decompiler.github.io/#jd-onlinehttps://stackoverflow.com/questions/6707695/iterate-through-string-array-in-javahttps://www.guru99.com/foreach-loop-java.htmlhttps://introcs.cs.princeton.edu/java/windows/manual.php
https://phoenixnap.com/kb/install-java-on-centoshttps://javatutorial.net/set-java-home-windows-10 https://surajgyawali.com/2015/10/15/how-to-setup-ibm-java-runtime-environment-jre-and-add-jre-as-a-system-variable-on-aix-7-1/https://access.redhat.com/articles/2950741
https://www.linuxcloudvps.com/blog/how-to-install-and-manage-multiple-java-versions-on-linux/
TODO To investigate...https://docs.oracle.com/javase/8/docs/technotes/guides/deploy/self-contained-packaging.htmlhttp://java-decompiler.github.io/#jd-onlinehttps://stackoverflow.com/questions/6707695/iterate-through-string-array-in-javahttps://www.guru99.com/foreach-loop-java.htmlhttps://introcs.cs.princeton.edu/java/windows/manual.php