You need Java 7 and the JAVA_HOME variable set for some stubborn legacy build or a tool that refuses to move on. This guide gets you the JDK, shows how to install it on Windows and Linux, walks through setting JAVA_HOME and verifies the setup from the command line. Yes this still matters in the year of newer Java versions.
Download the JDK from the Oracle archive or use a trusted package repository. If a modern Java is acceptable pick that instead to save yourself future pain. On Linux the system package manager is the easiest option when available.
Run the installer and follow the wizard like a functioning human. If you prefer scripts you can install the MSI or unpack an archive and then set environment variables with the command shown later. A common installation path looks like
C\Program Files\Java\jdk1.7.0_xx
Use your distro package manager or extract a tarball into a predictable location. Example for Debian style systems
sudo apt-get install openjdk-7-jdk
If you manually unpacked a tarball move the JDK folder to a stable path such as /usr/lib/jvm
so tools can rely on it.
Open System Properties and Advanced Environment Variables and add a new system variable named JAVA_HOME with the path to your JDK. For scripted installs use the setx command shown here
setx JAVA_HOME "C\Program Files\Java\jdk1.7.0_xx"
Important note that the new value only appears in new shells. Close and reopen any command prompt windows or restart your IDE to make it notice the change.
Edit your shell profile such as ~/.bashrc
or a system profile script and add an export line. Example
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
Save and reload the profile with a new shell or with source ~/.bashrc
if you must avoid a reboot. Yes you will still have to reopen terminals.
Confirm the JDK is usable and that the environment variable points at the right place. Run these commands in the appropriate shell
java -version
# on Linux
echo $JAVA_HOME
# on Windows in cmd
echo %JAVA_HOME%
If java -version
prints a Java 7 runtime and the echo output shows the JDK path you are golden. If not double check the path and remember Windows paths differ from Linux paths. Mixing them is a fast path to confusion.
This guide covered obtaining the JDK installing it on Windows and Linux setting JAVA_HOME and verifying the setup. Follow the platform specific steps and keep your paths sensible unless you enjoy debugging path related drama.
I know how you can get Azure Certified, Google Cloud Certified and AWS Certified. It's a cool certification exam simulator site called certificationexams.pro. Check it out, and tell them Cameron sent ya!
This is a dedicated watch page for a single video.