Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk10 min

How to Manually Install Oracle Java on a Debian or Ubuntu VPS

Install Oracle Java manually on a Debian or Ubuntu VPS with the correct x64 or ARM64 build. Follow archive or Debian package steps, configure JAVA_HOME and alternatives, verify java and javac, and update safely.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

On a Debian or Ubuntu VPS, install Oracle Java either from Oracle’s .tar.gz archive or its Debian .deb package. Choose the archive for a private, relocatable, or non-root installation; choose the package for a system-wide installation integrated with /usr/lib/jvm. In both cases, match the download to the VPS CPU, accept Oracle’s license, verify the SHA-256 checksum, configure JAVA_HOME, and check both java and javac.

The commands below cover Oracle JDK 27 naming as shown in Oracle’s current Linux catalog. Release numbers and filenames change, so copy the exact current filename from Oracle’s download page instead of hard-coding an old patch number.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What you need before installing

You need shell access with an account that can use sudo for a system-wide installation, enough disk space for the JDK and your application, and a supported 64-bit CPU. Oracle’s Linux bundles documented here are 64-bit only.

Check the CPU architecture and operating system

uname -m
. /etc/os-release && printf '%s %sn' "$ID" "$VERSION_ID"

Interpret the architecture result as follows:

  • x86_64 means download Oracle’s Linux x64 build for Intel or AMD 64-bit processors.
  • aarch64 or arm64 means download Oracle’s Linux aarch64 (ARM64) build.
  • A 32-bit result is not covered by the current Linux bundles in this guide; stop rather than installing a mismatched binary.

Update package metadata and install the utilities used by the procedures:

#1 Best Overall
Sale
TOZO A1 Wireless Earbuds Bluetooth 5.3 Light Weight in Ear Headphones | IPX5 Waterproof,2 Mics for AI Calls,Immersive Premium Sound Bass Headset with Charging Case,32 EQ via App Black
  • [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
  • [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
  • [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
  • [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
  • [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.
sudo apt-get update
sudo apt-get install -y ca-certificates curl tar

ca-certificates lets HTTPS clients validate Oracle’s certificate, curl can retrieve the artifact or checksum after you have accepted the license, and tar extracts the archive. A Debian package installation also uses the already-installed dpkg utility.

Choose the archive or Debian package

Decision Oracle .tar.gz Oracle .deb
Root access Not required when extracted under a directory the user owns; sudo is normally used for /opt. Required because the package installs system-wide.
Typical location A chosen directory such as /opt/oracle or $HOME/.local/lib. /usr/lib/jvm/jdk-<VERSION>-oracle-<ARCH>, according to Oracle’s package layout.
Multiple versions Easy to keep side by side and select with a symlink or alternatives. Managed as installed packages; parallel versions depend on the package names and alternatives entries available.
Lifecycle You replace or add directories manually and remove old ones after migration. dpkg records the installation and package removal is handled through Debian’s package tools.
Best fit Private application runtimes, controlled deployments, or a non-root account. A host-wide Java installation that should follow Debian filesystem conventions.

Neither route is inherently faster at runtime. The meaningful differences are ownership, filesystem placement, upgrade handling, and how explicitly you control more than one JDK.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Get the correct Oracle artifact

Use Oracle’s current download listing

Oracle requires acceptance of its license agreement before downloading the JDK. Open Oracle’s current Java downloads catalog, accept the license for the release you intend to use, and select the Linux x64 or Linux aarch64 artifact that matches uname -m. The catalog currently lists JDK 27 archives for both architectures and an x64 Debian package; a later update may change the release number or available package architectures.

Download the exact filename displayed for your release. Oracle states that download URL patterns remain stable across update releases, which is useful for automation, but the filename and checksum still need to be refreshed when you update.

Verify the SHA-256 checksum

Oracle exposes a SHA-256 link beside each listed binary. Download that checksum information from the same release listing and compare it with the file on the VPS before extracting or installing it. If the downloaded checksum is a plain value followed by a filename, this works:

sha256sum -c jdk-<VERSION>_linux-x64_bin.tar.gz.sha256

If Oracle provides a different checksum-file format, compute the local value and compare it with the published value:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sha256sum jdk-<VERSION>_linux-x64_bin.tar.gz

Do not continue when the values differ. A mismatch can mean a partial download, a wrong architecture, a stale checksum, or an altered file. Re-download the artifact and checksum from Oracle’s current listing and check again.

Install Oracle Java from a tar.gz archive

The archive is relocatable: extraction creates a JDK directory containing bin/java, bin/javac, and the other tools. The archive does not automatically become Debian or Ubuntu’s default Java.

Rank #2
Sale
Smart Watch for Men Women Compatible with iPhone Samsung Android Phone 1.69 inch Full Touch Screen IP68 Waterproof Bluetooh Fitness Tracker Heart Rate/Sleep Monitor (Black)
  • 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
  • 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
  • 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
  • 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
  • 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.

System-wide archive under /opt

For a shared VPS, use a versioned directory and a stable symlink. Replace the filename and directory name with the release shown by Oracle:

sudo install -d -m 0755 /opt/oracle
sudo tar -xzf jdk-<VERSION>_linux-x64_bin.tar.gz -C /opt/oracle
sudo ln -sfn /opt/oracle/jdk-<VERSION> /opt/oracle/jdk-current

For ARM64, use Oracle’s aarch64 archive filename instead of the x64 name. The extracted directory is named for the JDK release. Confirm what was created:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
ls -ld /opt/oracle/jdk-*
ls -l /opt/oracle/jdk-current/bin/java

Keep the extracted tree readable and executable by the account that runs the application. Do not make the entire JDK world-writable; an attacker who can replace bin/java or a library can execute arbitrary code whenever a service starts.

Per-user archive under the home directory

A non-root account can install its own JDK below a writable directory:

mkdir -p "$HOME/.local/lib"
tar -xzf jdk-<VERSION>_linux-x64_bin.tar.gz -C "$HOME/.local/lib"
ln -sfn "$HOME/.local/lib/jdk-<VERSION>" "$HOME/.local/lib/jdk-current"

This avoids changing the host’s Java selection. It is useful when you cannot obtain sudo, when one application needs a different JDK, or when testing an update without affecting existing services.

Set JAVA_HOME and PATH for an interactive shell

For the system-wide /opt installation, add the environment to the account that will launch Java applications:

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
cat >> ~/.profile <<'EOF'
export JAVA_HOME=/opt/oracle/jdk-current
export PATH="$JAVA_HOME/bin:$PATH"
EOF
. ~/.profile

For a per-user installation, set JAVA_HOME to $HOME/.local/lib/jdk-current instead. The profile is read by many login shells, but an already-open shell may need the . ~/.profile command or a new login before the change appears.

Putting $JAVA_HOME/bin first in PATH makes commands such as java, javac, and jar resolve to this JDK for that account. It does not change the alternatives selection for other users.

Rank #3
New Bee Guitar Cable 10ft Electric Instrument Bass AMP Cord
  • [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
  • [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
  • [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
  • [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
  • [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by

Install Oracle Java from the Debian package

Oracle’s Debian route is system-wide and documented for an x64 package. Download the current x64 .deb after accepting the license and checking its SHA-256 value, then install the exact file:

sudo dpkg -i jdk-<VERSION>_linux-x64_bin.deb

Oracle places the package under a path similar to:

/usr/lib/jvm/jdk-<VERSION>-oracle-<ARCH>

The package may register Java commands with Debian’s alternatives system. Inspect the result rather than assuming which version was selected:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
dpkg -l | grep -E 'jdk|oracle'
ls -ld /usr/lib/jvm/jdk-*-oracle-*

Repair missing dependencies

If dpkg reports unmet dependencies, let APT complete the dependency configuration and then run the package installation again:

sudo apt-get -f install
sudo dpkg -i jdk-<VERSION>_linux-x64_bin.deb

Read the APT transaction before confirming it. Do not use an unrelated package from another distribution or architecture to silence the error. If the package still fails, check that the VPS is a supported Debian or Ubuntu release and that the downloaded file matches the host architecture.

Make Oracle Java the Debian or Ubuntu default

A tarball installation is just files until you either call its absolute path, set JAVA_HOME, or register it with update-alternatives. Register both the runtime and compiler so tools do not end up using different JDKs.

Register a tarball installation

With the stable symlink from the archive procedure, run:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo update-alternatives --install /usr/bin/java java /opt/oracle/jdk-current/bin/java 20000
sudo update-alternatives --install /usr/bin/javac javac /opt/oracle/jdk-current/bin/javac 20000

The final number is the alternatives priority. A higher priority can win automatic selection, but use explicit configuration when you need a predictable result. Select the desired entries:

sudo update-alternatives --config java
sudo update-alternatives --config javac

Each command displays numbered candidates. Enter the number whose path points to the intended Oracle JDK. Selecting java does not automatically select the matching javac; configure both.

Rank #4
BSIMB 15.6" Digital Family Calendar & Chore Chart, No Subscription Fees
  • Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
  • Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
  • All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
  • Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
  • Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.

Inspect alternatives after a .deb installation

A package may already have created alternatives entries. Display them first:

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo update-alternatives --display java
sudo update-alternatives --display javac

If the Oracle entry exists, choose it with the corresponding --config command. If it does not, register the package’s actual paths, not a guessed version string:

sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk-<VERSION>-oracle-<ARCH>/bin/java 20000
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk-<VERSION>-oracle-<ARCH>/bin/javac 20000

Use the directory shown by ls /usr/lib/jvm; package naming can differ between releases and architectures.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Verify the runtime, compiler, path, and environment

Run all of these checks as the account that will use Java:

java -version
javac -version
readlink -f "$(command -v java)"
update-alternatives --display java
printf 'JAVA_HOME=%sn' "$JAVA_HOME"
"${JAVA_HOME:-/usr}/bin/java" -version
  • java -version should identify the intended Oracle JDK release. Oracle specifically documents this command as confirmation of the recently installed default JDK.
  • javac -version confirms that the compiler is present; it distinguishes a full JDK from a runtime-only setup.
  • readlink -f resolves /usr/bin/java through alternatives and symbolic links to the actual executable.
  • update-alternatives --display java shows all registered candidates and the active mode.
  • The JAVA_HOME output must match the directory containing the selected bin/java.

If java and javac report different releases, configure both alternatives entries again or remove an old PATH entry that appears before /usr/bin or $JAVA_HOME/bin.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Verify a systemd service separately

Services usually do not read a user’s .profile. A shell test can therefore succeed while an already-running daemon still uses an older JDK. Set the runtime explicitly in the unit, for example:

[Service]
Environment="JAVA_HOME=/opt/oracle/jdk-current"
Environment="PATH=/opt/oracle/jdk-current/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin"
ExecStart=/opt/oracle/jdk-current/bin/java -jar /srv/example/app.jar

After editing the unit, reload it, restart the service, and inspect its status and logs:

sudo systemctl daemon-reload
sudo systemctl restart example.service
sudo systemctl status example.service
sudo journalctl -u example.service -n 100 --no-pager

Using an absolute ExecStart path removes ambiguity when several JDKs coexist. The service account must be able to traverse and read the JDK directory and the application files.

Troubleshooting common failures

“Exec format error” or an immediate crash

The binary probably does not match the CPU architecture. Run uname -m, remove the wrong archive or package, and obtain the corresponding x64 or aarch64 build. Do not try to fix an architecture mismatch with alternatives.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

java: command not found

For an archive, confirm that $JAVA_HOME/bin is in the current shell’s PATH, source the profile again, or call the absolute path. For a system-wide default, check whether /usr/bin/java exists and whether an alternatives entry was registered.

The version is still the old one

Run type -a java and readlink -f "$(command -v java)". An earlier JDK directory in PATH, a shell command hash, or an unchanged alternatives selection can all point to the old executable. Open a new login shell after changing profile files, then select the intended entries for both java and javac.

Permission denied when a service starts

Check the service’s user, directory traversal permissions, and the ownership of the extracted JDK. A private installation below one user’s home directory may be inaccessible to a daemon running as another account. Move the archive to a shared location such as /opt with restrictive but readable permissions, or install the package system-wide.

Checksum verification fails

Delete the incomplete file, download the artifact and checksum again from the same Oracle release listing, and ensure the checksum belongs to the exact architecture and filename. Never install a file whose digest does not match Oracle’s published value.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Updating, switching, and rolling back

Record the artifact filename, checksum, installation date, selected path, and service changes in your change log. For a controlled update, install the new JDK alongside the current one, test the application with its absolute path or a staging symlink, and switch only after the test succeeds.

Archive update with a stable symlink

sudo tar -xzf jdk-<NEW_VERSION>_linux-x64_bin.tar.gz -C /opt/oracle
sudo ln -sfn /opt/oracle/jdk-<NEW_VERSION> /opt/oracle/jdk-current

If alternatives points to /opt/oracle/jdk-current/bin/java, the symlink change affects the next process launch. Restart each service deliberately and verify its logs. If a test fails, point jdk-current back to the previous directory and restart the affected service.

Alternatives-based rollback

When each archive has its own registered path, run sudo update-alternatives --config java and sudo update-alternatives --config javac, then choose the previous entries. Keep an old directory until every service has been tested on the replacement; deleting it first leaves alternatives pointing at a nonexistent executable.

Removing an old Debian package

Identify the exact package recorded by dpkg -l before removing it. Check which services and alternatives entries use that JDK, switch them to the replacement, and then remove the old package with the package manager. Do not manually delete a package-managed directory while its package remains installed.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Oracle Java versus OpenJDK on Ubuntu

Ubuntu’s official guidance notes that Oracle HotSpot and OpenJDK generally have no functional difference for most applications. OpenJDK is maintained in Ubuntu’s archive and has clearer licensing and support integration there. Oracle JDK can still be the required choice for a vendor certification, a company standard, or a workload that explicitly names Oracle’s distribution. Decide based on your application’s support and licensing requirements, not on an assumption that one VM is universally faster.

Operational checklist

  • Confirm x86_64 versus aarch64/arm64 before downloading.
  • Accept Oracle’s license and copy the current filename from its download catalog.
  • Retrieve and verify the matching SHA-256 checksum.
  • Choose .tar.gz for a relocatable or user-level install, or .deb for a system-wide package-managed install.
  • Set JAVA_HOME and PATH for interactive users.
  • Register and select both java and javac when Oracle Java should be the Debian or Ubuntu default.
  • Verify runtime version, compiler version, resolved executable, alternatives state, and JAVA_HOME.
  • Configure service units explicitly, restart them, and inspect their own logs.
  • Keep the previous JDK until the application has passed testing and rollback is no longer needed.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.