Downloading Java JDK on Linux via wget is shown license page instead
Fetch the Java JDK on Linux using this curl
command:
Replace <JDK_DOWNLOAD_URL>
with the exact link to the JDK you're after. This method deals with cookie acceptance needed by Oracle, and bypasses the license page. Please ensure you've agreed to Oracle's license terms beforehand.
Expanded explanation and tips
Utilizing wget for JDK retrieval
If you're a wget
fan, here's what you need:
Substitute <JDK_DOWNLOAD_URL>
with the Oracle JDK download link in question. If your download gets interrupted, don't sweat, just use the -c
option to continue the download:
Keep in mind, for a 32-bit JDK, replace any occurrence of x64
in the download URL with i586
.
Timing and link lifespan matters
After agreeing to Oracle's terms, start the download within 30 minutes. Why? Otherwise, you might find that your link has expired, forcing you to go through the steps again.
When browsers come to the rescue
Does wget
or curl
still remain stubborn? No problem. Start the download with a browser, hit pause, then copy the command from the downloads tab. This is an effective workaround for wget
or curl
to comply with Oracle's license.
Automating JDK deployment on Debian derivatives
In Debian or Ubuntu, use these commands to automate Java installation:
Just remember to check that the PPA and package names correspond to your JDK of choice. They're subject to changes.
Keep Oracle's rules under consideration
These approaches effectively bypass the license page, but Oracle's rules technically call for manual acceptance via a browser. I recommend using these CLI tricks responsibly, acknowledging the licensing agreements.
JDK 9 and beyond: Making life simpler
From JDK 9 onwards, downloading binaries isn't as messy. Portal like java.net
simplify the task offering direct download links without the cookie tango:
Make sure to replace [java.net-JDK-download-URL]
with the desired URL from the website.
Up-to-date with evolving changes
Oracle JDK download URLs and cookie values can and do change - check the current requirement always to avoid stumbling blocks in downloads.
Was this article helpful?