The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →On an Ubuntu or Debian VPS, install Java with APT in four stages: identify the distribution and CPU architecture, refresh package metadata, install either a runtime or a development kit, then verify the binaries. Use default-jre to run an existing Java application, default-jdk when the server must compile code, or a versioned package such as openjdk-21-jdk when the application requires a particular Java line. If more than one Java version is installed, select the active environment with Debian’s alternatives tooling instead of replacing system links manually.
Antihost offers Linux VPS plans with full root access, unlimited traffic on a 1 Gbps port and a 14-day free trial.
What you need before installing Java
This procedure assumes an Ubuntu or Debian VPS that you can reach over SSH and a user allowed to run commands with sudo. APT installs packages from the distribution repositories, so the package name and the Java version represented by a default package depend on the release and architecture.
As an Amazon Associate I earn from qualifying purchases.
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallConfirm the operating system
Check the release before choosing a package. The following command prints the distribution identification supplied by the operating system:
cat /etc/os-release
Ubuntu and Debian both use APT, but their release defaults are not identical. Debian’s documentation specifically warns that the dependency behind default-jdk can vary by release and architecture. Do not assume that a package called “default” represents the same major Java version on every VPS.
#1 Best Overall
- BLUE LIGHT BLOCKING GLASSES: Our blue light glasses for women boast UV400 protection, blocking harmful blue rays from computer screens. With these bluelight glasses women, you can enjoy gaming, reading, or watching TV with no worries of eye strain.
- EYE RELIEF: Our blue light glasses are engineered to reduce blurry vision or strain caused by prolonged screen time. These womens blue light glasses aid in better sleep by preventing blue light from disrupting your natural sleep cycle, helping you fall asleep faster and enjoy a more restful night's sleep, making them the perfect christmas present.
- COMFORTABLE: Crafted from durable material, our trendy blue light glasses for woman or blue light glasses men ensure long-lasting comfort. The high-transmittance lenses accessories, gamer gifts for men, help keep your eyes relaxed. Perfect stocking stuffers, gifts for gamers men, christmas gifts for men, halloween costumes.
- LIGHTWEIGHT: These clear blue light glasses feature a lightweight frame, meaning they’ll stay comfy for long-term wear. Perfect as blue blockers glasses for women or mens blue light glasses, these non-prescription fake glasses for men can be worn throughout the day. The blue light blocking glasses women feature polycarbonate HD lenses, which are anti-reflective and restore true color.
- WORRY-FREE PURCHASE: If you experience any issues, our support team is ready to assist you quickly. These are the perfect costume glasses for cosplay dressing up.
Confirm the architecture
Package availability can differ by CPU architecture. Record the architecture reported by the package system before hard-coding a version into a deployment script:
dpkg --print-architecture
If the VPS uses an architecture for which a requested OpenJDK build is not published in its configured repositories, APT will not be able to install that version even when the package name is valid on another machine.
Decide whether you need a JRE or a JDK
The Java Runtime Environment (JRE) is the appropriate starting point when the VPS only launches an already-built Java application. A Java Development Kit (JDK) is required when the server compiles source code or needs javac and other development tools. A non-graphical service can use a distribution headless variant, which omits graphical interfaces.
| VPS workload | Package pattern | What it provides |
|---|---|---|
| Run an existing Java application | default-jre or openjdk-<version>-jre |
Java runtime with a smaller dependency footprint than a full development kit |
| Compile Java or run build tools | default-jdk or openjdk-<version>-jdk |
Runtime plus the Java compiler and development tooling |
| Run a service with no GUI requirement | Distribution headless JRE or JDK variant | Java without graphical interfaces, as defined by Debian’s package documentation |
| Follow an application’s required Java major version | Versioned openjdk-<version>-jre or openjdk-<version>-jdk |
APT-managed updates within the selected major-version line |
Install Java with the standard APT workflow
Run these stages in order. The first command refreshes the local package index; the installation command then uses that index to resolve the package and its dependencies.
1. Refresh the package index
sudo apt update
Ubuntu’s server documentation identifies APT as the recommended command-line tool for Debian packages and uses sudo apt update to update the local index. Run it before the first installation and whenever APT reports stale or missing package metadata.
2. Inspect the release’s available Java packages when the version matters
For a release-default installation, you can proceed directly to default-jre or default-jdk. If an application is tied to a major version, inspect what the VPS repositories actually expose:
Free tools Windows power users keep installed
One-click scans. No signup required.
apt-cache policy default-jdk
apt-cache depends default-jdk
apt search openjdk
apt-cache policy default-jdk shows the candidate package selected by the configured repositories. apt-cache depends default-jdk reveals the package it depends on, which is useful when a Debian release maps the default to a particular OpenJDK line. apt search openjdk lists versioned and headless package names available to that VPS.
3. Install a runtime-only environment
Choose this path when the server only needs to start a prebuilt Java application:
Rank #2
- WINDEX GAMING WIPES: effortlessly clean all your gaming gear and gaming electronics in one easy step with our new Windex Gaming Wipes
- AMMONIA FREE: our ammonia-free formula is safe to use on all of your favorite gaming equipment like consoles, headsets, controllers, screens, keyboards, and more
- PRE-MOISTENED WIPES: each wipe instantly removes dust, dirt, and stubborn smudges and fingerprints leaving a streak-free shine
- ANTI-STATIC: great for cleaning and wiping down your gaming gear and electronics leaving behind no visible residue
- COMPACT RESEALABLE PACKAGE: store your pack of Windex Gaming Wipes anywhere in your home for whenever a quick and easy wipedown is needed
sudo apt install default-jre
Ubuntu documents default-jre as the current OpenJDK runtime package for most situations. A runtime installation supplies the java launcher but does not provide the Java compiler.
4. Install a development kit
Use the JDK when the VPS compiles Java, runs a build tool that invokes javac, or otherwise requires development utilities:
sudo apt install default-jdk
Ubuntu’s current developer guide gives this command for the release-default JDK. Because “default” follows the distribution release, check the package dependency first when a build has a strict Java requirement.
5. Install a specific OpenJDK major version
If the application documentation names a Java line, install the matching versioned package rather than relying on the moving release default. Ubuntu’s current example for a JDK is:
sudo apt install openjdk-21-jdk
The general form is sudo apt install openjdk-<version>-jdk; substitute a version that appears in apt search openjdk for the target release and architecture. For a runtime-only installation, use the corresponding openjdk-<version>-jre pattern.
6. Choose a headless variant for a non-GUI service
Many VPS workloads are daemons, API servers, job workers, or command-line tools with no graphical requirement. Debian defines headless Java packages as omitting graphical interfaces. Search the repository’s OpenJDK entries and select the matching headless JRE or JDK variant when the application does not need GUI libraries. A GUI-dependent Java application may instead require the regular, non-headless package.
7. Verify the installation
Check the runtime immediately after APT finishes:
java -version
When you installed a JDK, verify the compiler separately:
javac -version
Ubuntu explicitly uses java -version as its post-install check. A successful runtime check confirms that the shell can find the Java launcher; the compiler check confirms that the server has a JDK rather than only a JRE.
Rank #3
- Ergonomic & Adjustable Design: Fight "text neck" and improve your posture. Designed for comfort, it offers an adjustable height (7.1in-8.5in) (1.4in adjustable range) and angle (5°-85°) Please note: cell phone stand is only 9 inches tall—the length of a standard pencil
- Without blocking subtitles Perfect for office desk Tiktok Face Time Zoom video—this is the ultimate kitchen desk essential for phones! Perfect viewing experience while reducing neck back strain, A must-have for gamers streamers desk, and anyone who values both style and support!
- Sleek & Stable Design fits Otterbox Case: Say goodbye to bent cables, tangles, and tip-overs! LISEN’s stylish adjustable desk phone holder features a built-in charging hole and smart cable management, keeping your phone secure and your workspace clutter-free cool gadgets for men
- ANTI-SLIP DESIGN free hands: The under 10.00 items easy gadgets back and the bottom of this kitchen essentials for women are fully covered by anti-skid silicone, which LISEN stand up desk decor can provide maximum protection device from any scratches and slides
- Your Perfect Viewing Companion:If your product arrives damaged or breaks within 365 days, reach out to LISEN for a quick and hassle-free solution. Struggling with assembly, like tightening the screw? We’ve got your back! Your experience matters to us. (Product including: phone Holder stand*1, screw*1, hexagon screwdriver*1, specification*1)
8. Select the active Java installation when more than one exists
Installing a second major version does not mean every command automatically uses it. Debian provides the alternatives system for choosing the active Java environment. List the registered Java environments, then set the identifier that should be active:
sudo update-java-alternatives --list
sudo update-java-alternatives --set NAME_FROM_LIST
The value after --set must be one of the names printed by --list. Debian’s Java documentation recommends update-java-alternatives for changing Java environments together instead of managing each alternative separately. After switching, run both version checks again, when applicable, so the shell and compiler report the intended installation.
Ubuntu package choices and supported OpenJDK lines
Canonical’s Ubuntu developer documentation, updated in 2026, states that the Ubuntu Archive provides supported OpenJDK packages for all supported LTS releases. It also records OpenJDK 17 and OpenJDK 21 as TCK-certified on Ubuntu 24.04 LTS. For that release, the documented example for the latest LTS line is:
sudo apt install openjdk-21-jdk
That command installs a JDK, not merely a runtime. If the server only executes an application and the application accepts the distribution’s current runtime line, use default-jre instead. If the application requires Java 17, search for the versioned 17 package and install the JRE or JDK form that matches the workload.
Ubuntu’s “default” packages are convenient when the application supports the release’s chosen OpenJDK line. Versioned packages are more explicit for automation and for software whose compatibility statement names a major version. In either case, the repository configured on the VPS is authoritative: use apt search openjdk and apt-cache policy to confirm that the desired package is available before putting it in a script.
Debian package choices by release
Debian’s Java information lists OpenJDK 17 as the default for Bookworm (Debian 12) and OpenJDK 11 as the default for Bullseye (Debian 11). These defaults are release-specific, and Debian warns that the result can also differ by architecture. A script that blindly installs default-jdk may therefore select different major versions on two otherwise similar VPSs.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →For a Debian server, inspect the candidate and dependency before installation:
sudo apt update
apt-cache policy default-jdk
apt-cache depends default-jdk
apt search openjdk
If the application is certified for the release default, default-jre or default-jdk keeps updates aligned with Debian’s package set. If it must remain on a named major version, install the corresponding versioned package shown by the search results. The same distinction applies to runtime-only, development-kit, and headless choices.
Rank #4
- Easy Installation: Our gaming lights have been designed to enhance your entertainment experience. Simply position the led light bar next to your TV or game console to create a game room environment with ease. They come with USB power and a 60 inch cord for direct mounting and mobility
- Audio Syncing & Extensive Mode: The built-in high-sensitivity music sensor allows you to sync the TV led lights to your favorite music. Lights react and move to the beat of music, film and game audio, creating an incredible immersive sound and light experience – and all without the need for an additional hub. You can choose from 64+ patterns, including strobe, illusion, jump, energy, gradient, running, chasing, fluttering mode etc. Each mode can be applied to different scenes
- 64+ Chasing IC+RGB & W Effect: The independent control design of IC+RGB and white all-in-one multifunctional rgbw led bar lights monitor backlight allows you to easily switch the led lights for desk between IC+RGB and white to enjoy a variety of lighting effects, you can choose white lighting mode with high brightness for better illumination when working, etc. Choose IC+RGB lighting mode when you need to create an entertaining atmosphere for the light show, 16 million colours of Color changing rgb light bar let you dance to the beat and create a dynamic party atmosphere
- Dynamic and Dimmable Lights: 1%-full brightness free brightness adjustment gives you the flexibility to adjust dimmable led light bar for room decorations or a variety of occasions
- USB Powered: USB light bars for room can be powered by powernank, usb charger, TV, Monitor, laptop PC mainframe, making behind TV led lighting bar easy to install in any location.TV led lights are powered by the TV usb interface / PC mainframe, can be turned on/off synchronously with TV / PC
Choosing between default and versioned packages
Use a default package when the application follows the distribution
default-jre and default-jdk express “the Java version selected for this release.” They reduce the need to encode a major-version number and let the distribution maintain the default package relationship. This is a practical choice for software that documents support for the VPS release rather than for one exact Java line.
Use a versioned package when compatibility is explicit
A versioned package states the intended major line directly, such as openjdk-21-jdk. It is clearer in provisioning scripts and prevents a future release-default change from silently selecting another major version. The version still has to exist in the repositories for the VPS’s release and architecture, so verify it with APT before installation.
Use a headless package when graphics are unnecessary
Headless packages omit graphical interfaces. That matches a typical server process that listens for requests, executes jobs, or runs from a terminal. Do not choose headless packages for software that genuinely depends on graphical Java libraries; Debian’s definition is specifically about removing those interfaces, not about making every Java application compatible.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Common installation failures and precise fixes
“Unable to locate package”
APT cannot resolve the requested name when its package index is stale, the repository component is unavailable, the version is not built for the VPS architecture, or the package name does not exist for that release. Work through the causes in this order:
- Refresh metadata:
sudo apt update. - Check whether the exact name has a candidate:
apt-cache policy PACKAGE_NAME. - Search the repository’s available names:
apt search openjdk. - Confirm the operating-system release and architecture, then choose the package name published for that combination.
Do not replace a missing package with a guessed version suffix. The package search and policy output establish which names APT can install on that VPS.
Recommended Free Tools
java works but javac is missing
This normally means the server has a JRE rather than a JDK. Install the matching default or versioned JDK package, then verify:
sudo apt install default-jdk
javac -version
If the application requires a specific major line, use its versioned -jdk package instead of changing to an unrelated default.
The wrong Java version is active
When several installations are present, use the alternatives system rather than editing /usr/bin/java manually:
Best Value
- Compatible with Wide Screens - To ensure compatibility with the dual monitor mount, your each monitor must meet three conditions at the same time: First, computer screens size range: 13 to 32 inches. Second, screen weight range: 4.4 to 19.8 lbs. Third, the back of the monitor screen must have VESA mounting holes with a pitch of 75x75mm or 100x100mm.
- Regarding the compatibility with desks - Your desk must meet three conditions at the same time: First, desk material: Only wooden desks are recommended, plastic or glass desks cannot be used. Second, desk thickness range: 0.59" - 3.54". Third, the bottom of the desk should not have any cross beams or panels, as this will interfere with installation. We recommend carefully checking that your desk and monitors meets all above conditions before purchasing.
- Dual C-Clamp Hold - Worried your dual monitors might wobble or slip? Our upgraded base uses a larger platform plus a dual C-clamp structure to lock the dual monitor arm firmly to your desk. Each arm safely keeps your screens steady while you type, click and game—no shaking, no sliding, just a clean and secure setup you can trust every day. It also provides Grommet Mounting installation choice, both options ensure stable and secure fixation for your 0.59" - 3.54" desk.
- Full-Motion Adjustment For Comfortable View - Pull the screen closer when you’re deep in a spreadsheet, push it back to watch videos, or rotate to portrait for coding — moving everything smoothly with just one hand. The monitor stand offers +85°/-50° tilt, ±90° swivel and 360° rotation. Raise your monitor up to 15.75″ to support a healthy sitting posture. Whether you’re working from home, gaming through the night, or switching between video calls and documents, getting the screens to your natural line of sight helps relieve neck, shoulder and back strain so you can stay focused longer with less fatigue.
- Keep Your Desk Organized: By lifting both screens off the desktop, this dual monitor stand opens up valuable space for your keyboard, notebook, docking station or a simple, clutter-free work area. Built-in cable management guides wires along the arms, keeping cords out of sight and out of the way. Enjoy a tidy, modern workstation that looks as good as it feels to use.
sudo update-java-alternatives --list
sudo update-java-alternatives --set NAME_FROM_LIST
java -version
javac -version
The final compiler check applies when a JDK is installed. Selecting the complete Java environment keeps the launcher and development tools aligned.
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Clear out junk files and repair common Windows errors3Scan for outdated or missing drivers - takes under a minuteA GUI application fails on a headless installation
A headless package intentionally omits graphical interfaces. If the application needs GUI-dependent Java libraries, install the corresponding regular JRE or JDK package available for the release. A typical VPS daemon without graphical requirements should remain on the headless variant.
APT and manually extracted Java installations conflict
Keep the package source consistent. Ubuntu and Debian repository packages receive distribution-managed updates, while a manually extracted Oracle tarball is outside that package-management flow. Mixing both approaches complicates upgrades and alternatives management. If the VPS is managed with APT, install and update the Java environment through the same repository system whenever the required version is available there.
Reusable command recipes
Runtime-only server using the release default
sudo apt update
sudo apt install default-jre
java -version
This is the shortest supported path for a prebuilt Java service that does not compile code on the VPS.
Build server using the release-default JDK
sudo apt update
sudo apt install default-jdk
java -version
javac -version
The second version check confirms that the compiler arrived with the development kit.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Server pinned to OpenJDK 21
sudo apt update
apt search openjdk
sudo apt install openjdk-21-jdk
java -version
javac -version
Ubuntu documents openjdk-21-jdk as its current latest-LTS example. On another release, first confirm that the same package is published for that release and architecture.
Multiple Java lines installed
sudo update-java-alternatives --list
sudo update-java-alternatives --set NAME_FROM_LIST
java -version
Use the identifier returned by the list command. This changes the active environment through the alternatives mechanism instead of replacing package-managed links.
Operational checklist for a VPS
- Record the Ubuntu or Debian release and the architecture before selecting a version.
- Run
sudo apt updateimmediately before the first installation when package metadata may be old. - Choose
default-jrefor execution only,default-jdkfor compilation, and a versioned package when the application names a Java major line. - Use a headless variant for a service that has no graphical requirement; use a regular package for GUI-dependent software.
- Verify with
java -version; addjavac -versionwhenever a JDK was installed. - Inspect
apt-cache policy,apt-cache depends, andapt search openjdkbefore hard-coding a package that may differ by release or architecture. - When more than one Java installation exists, select it with
update-java-alternatives. - Keep Java installation and updates within the distribution’s APT repositories when possible, rather than mixing package-managed files with manually extracted archives.
What a successful installation looks like
A runtime-only installation ends with a working java command and a reported OpenJDK version. A JDK installation reports both a Java runtime and a javac compiler. If the displayed major version differs from the one your application requires, the packages may both be present but the wrong alternatives selection is active; list and set the intended environment, then repeat the checks. If APT cannot find the package at all, resolve repository, release, architecture, and naming issues before attempting another installation method.
Quick Recap
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.




