What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
You can install a Java Development Kit (JDK) from Windows Command Prompt by running a package-manager command such as winget install --id Microsoft.OpenJDK.21, or by calling a vendor’s installer from a .cmd or .bat script. Choose the JDK distribution and major version first; package IDs and installer switches are vendor-specific. Then configure PATH and, if your tools need it, JAVA_HOME, and verify the result in a new Command Prompt.
Choose a JDK distribution and installation method
A JDK includes the Java runtime and the compiler, javac, so it is the right choice for development. Microsoft’s Windows Java guide lists Microsoft Build of OpenJDK, Eclipse Temurin, and Oracle JDK. Microsoft Learn says, “For most developers, Microsoft Build of OpenJDK or Temurin are good choices.” Check the current license terms and your organization’s policy before choosing a distribution, especially for commercial Oracle JDK use; licensing can vary by version and use case. Microsoft’s Windows Java guide describes Microsoft Build as free and open source and Temurin as an open-source distribution, and notes Oracle JDK’s commercial-use licensing requirements.
| Method | Best suited to | What to plan for |
|---|---|---|
| WinGet | Quick setup or a script that installs a package-manager listing | Confirm the package ID and version; availability and command behavior can depend on the Windows environment and organizational policy. |
| Vendor installer | Unattended deployment where you need explicit installer features or vendor-specific logging | Use switches documented for that exact vendor and installer type; specify scope and features deliberately. |
Install Java with WinGet from a CMD script
Microsoft Learn currently gives winget install Microsoft.OpenJDK.25 as an example, while its Windows setup guide also shows Microsoft OpenJDK 21 and Eclipse Temurin 21. The following uses OpenJDK 21 as an example, not a guarantee that this package or version will remain available:
@echo off
winget install --id Microsoft.OpenJDK.21
if errorlevel 1 (
echo Java installation failed. Check WinGet output and package availability.
exit /b 1
)
echo Java installation command completed.
exit /b 0
Save the text as a file such as install-java.cmd, then run it from Command Prompt. To check current package IDs before choosing one, use:
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →#1 Best Overall
- 14" diagonal, 1366x768 resolution, HD BrightView LED, Glossy NON-TOUCH Display
winget search Microsoft.OpenJDK
Microsoft also documents winget install EclipseAdoptium.Temurin.21.JDK as an example. Search for the desired vendor and major version, then confirm the exact ID shown on the machine where the script will run. For a quiet WinGet installation, add --silent; WinGet documentation also describes --id, --version, --scope, and --log. Use an exact version when repeatability matters, and choose scope explicitly if your deployment requires per-user or per-machine installation. See WinGet install command options.
WinGet may not be installed or usable on every Windows system, and network access, enterprise policy, existing installations, and architecture can affect a run. Test the script in the same environment and with the same account permissions as its intended use.
Rank #2
- 1.1 GHz (boost up to 2.4GHz) Intel Celeron N5030 Quad-Core
- 4GB DDR4 System Memory; 128GB Solid State Drive
- 11.6" HD (1366 x 768) Multi-Touch Display
- Combo headphone/microphone jack - Noble Wedge Lock slot - HDMI; 2 USB 3.1 Gen 1
- Windows 11 Pro
Run a vendor installer silently from CMD
If you have downloaded an installer, place it in a known location or use a full path to the file. Microsoft documents these examples for its own OpenJDK installer; the switches are not universal across vendors.
Microsoft OpenJDK EXE installer
Replace <package>.exe with the actual downloaded filename. This example requests an all-users install, adds the PATH and JAR association features, and sets an installation directory:
Recommended Free Tools
Rank #3
- 256 GB SSD of storage.
- Multitasking is easy with 16GB of RAM
- Equipped with a blazing fast Core i5 2.00 GHz processor.
@echo off
"C:pathto<package>.exe" /SILENT /SUPPRESSMSGBOXES /ALLUSERS /TASKS="FeatureEnvironment,FeatureJarFileRunWith" /DIR="C:Program FilesMicrosoft"
if errorlevel 1 (
echo Installer failed with exit code %ERRORLEVEL%.
exit /b %ERRORLEVEL%
)
exit /b 0
For a current-user installation, Microsoft documents using /CURRENTUSER in place of /ALLUSERS. /VERYSILENT suppresses the progress screen, and /DIR is optional. Microsoft’s installer features include options for PATH, .jar association, JAVA_HOME, and registry integration; choose the features required by your environment rather than assuming every installer enables them by default. The exact switches and available features are documented in Microsoft’s OpenJDK installation guide.
Microsoft OpenJDK MSI installer
For Microsoft’s MSI package, its documented pattern is:
Rank #4
- EFFORTLESS EVERYDAY PERFORMANCE: Powered by Intel Celeron N4020 processor and Windows 11 Home system, delivering reliable, low-power efficiency for daily tasks like document editing, email, online classes, and web browsing
- 15.6-INCH FULL HD DISPLAY: Enjoy immersive visuals on the 15.6" FHD (1920x1080) anti-glare screen with micro-edge bezels. Delivers clear details and comfortable viewing for long study sessions, working on spreadsheets, and video playback
- RESPONSIVE MULTITASKING & STORAGE: Built with 4GB LPDDR4 RAM and 128GB eMMC storage for smooth daily essential use. Expand your storage by up to 1TB via the integrated TF card slot to easily store movies, photos, and working files
- ADVANCED CONNECTIVITY: Outfitted with 2x Full-Featured Type-C ports for data transfer, fast charging, and dual-monitor output, alongside 2x USB 3.2 Gen1 ports and a 3.5mm audio jack for complete peripheral compatibility
- LIGHTWEIGHT & SILENT OPERATION: Slim and portable for effortless travel or commuting. Features a 1MP HD webcam for remote meetings, 38Wh battery with 45W Type-C fast charging, and a fanless silent design for peaceful work environments.
msiexec /i "C:pathto<package>.msi" ADDLOCAL=FeatureMain,FeatureEnvironment,FeatureJarFileRunWith,FeatureJavaHome INSTALLDIR="C:Program FilesMicrosoft" /quiet
INSTALLDIR must be used with FeatureMain. The selected features request the main product, environment configuration, JAR association, and JAVA_HOME integration. Check the vendor’s documentation for the exact feature names and behavior for the installer you downloaded.
Other vendors: do not reuse Microsoft’s switches blindly
Eclipse Temurin also documents silent MSI installation features including FeatureMain, FeatureEnvironment, FeatureJarFileRunWith, and FeatureJavaHome. Its Windows MSI packages are supported on Windows x64 and are intended for per-machine installation. Consult Adoptium’s installation documentation for Temurin-specific commands and current package details.
Best Value
- WINDOWS 11 | STABLE PERFORMANCE: Powered by Intel Celeron N4020 processor and Windows 11 system, this laptop delivers stable performance for everyday computing tasks. It supports web browsing, online learning, document editing, email communication, and basic office work with optimized power efficiency, providing a practical and reliable experience for essential daily use for daily use.
- 15.6” FHD IPS DISPLAY: Features a 15.6-inch Full HD IPS display with narrow bezels, offering wider viewing angles and clearer image details compared to standard panels. The improved screen-to-body ratio enhances visual experience for study, reading, document work, and video playback, making it suitable for both productivity and entertainment use.
- 4GB DDR4 + 128GB eMMC STORAGE: Equipped with 4GB DDR4 memory and 128GB eMMC storage for everyday basics such as browsing, documents, email, and online learning platforms. The built-in TF card slot supports storage expansion up to 1TB, giving you more flexibility for files, photos, videos, and daily documents. TF card not included.
- CONNECTIVITY & PORTS: Includes 1× TF card slot, 2× USB 3.2 Gen1 ports, and 2× full-featured Type-C ports (USB 3.2 Gen1). The Type-C ports support data transfer, charging, and video output, enabling flexible connection with external devices such as monitors, storage, and peripherals for daily work and study use.
- LIGHTWEIGHT DESIGN | ONLINE COMMUNICATION: Designed with a slim, portable profile, this laptop is easy to carry for school, commuting, and travel. A built-in 1MP front camera supports online classes, video meetings, remote communication, and everyday conferencing. The 3300mAh battery works with the low-power system design to support practical daily use, while thermal optimization helps maintain quieter operation during extended tasks.
Oracle’s Windows installation page applies specifically to JDK 24. Its examples include msiexec.exe /i jdk-24_windows-x64_bin.msi /qn for a silent MSI installation and jdk.exe /s for a silent EXE installation; it also documents adding /L C:pathsetup.log to create an installation log. These are JDK 24 examples, not general commands for later Oracle releases. Confirm the current filename, installer switches, and license terms on Oracle’s JDK 24 Windows installation page.
Set PATH and JAVA_HOME deliberately
PATH lets Command Prompt locate java.exe and javac.exe by name. Many development tools also look for JAVA_HOME, typically expecting it to point to the JDK installation directory. Microsoft and Temurin installers offer features that can configure these values; Microsoft notes that JAVA_HOME may need to be set manually when required. If you manage environment variables yourself, use the actual installation path and avoid replacing the existing PATH value. A JDK update or a second installed JDK may change which Java executable runs first.
- For a single-user machine, decide whether the installation and environment variables should apply only to that account.
- For a shared machine or managed deployment, confirm administrator rights and the intended system-wide scope.
- If multiple JDKs are installed, ensure PATH and JAVA_HOME point to the intended version rather than relying on whichever installer ran last.
Verify the installation and handle common failures
Open a new Command Prompt after installation so it reads updated environment variables. Run:
java -version
javac -version
echo %JAVA_HOME%
java -version should print the installed runtime version; javac -version confirms that the compiler is available, which matters for development. echo %JAVA_HOME% prints the configured value or leaves the variable unresolved if it is not set. If a command is not recognized, check that the installer completed, the relevant PATH feature is enabled or configured, and that you opened a fresh Command Prompt. If JAVA_HOME is required by your tools but is missing or points to a different JDK, set it to the correct JDK directory and reopen the terminal.
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 minute- WinGet reports an unknown package: run
winget searchfor the vendor, confirm the package ID and available version, and adjust the script to the listing that is actually available. - The installer exits unsuccessfully: check the returned exit code and installer output; use a vendor-supported log option where available. Avoid treating a silent run as proof of success.
- An all-users install fails: confirm the script is running with the required elevation and that the chosen installer supports the requested scope.
- A version mismatch appears: inspect the executable selected through PATH and check for other installed Java versions before changing environment settings.
Make unattended scripts more reliable
For repeatable setup, make the distribution, major version, package ID or installer filename, scope, and environment features explicit. Capture and check the command’s exit status; if the selected installer supports logging, write a log to a known writable location. Use one installation method for a given JDK version at a time rather than mixing a package-manager install and a manual installer for the same version. WinGet’s documented options are available at the WinGet install command reference; because command-line behavior and vendor listings can change, verify those details against the current documentation before deploying broadly.
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.

