To develop Java applications on Windows 11, install a Java Development Kit (JDK) from a trusted JDK provider, then verify that both the java and javac commands use the version you expect. You do not need to choose one specific JDK release for every project—the correct version depends on the software, course, build tool, or framework you plan to use.
1. Choose the JDK Version You Need
Check your project’s requirements before downloading anything. Some projects require a particular long-term-support or feature release. Installing the newest JDK is not always the correct choice for an older application or course.
2. Download a JDK from an Official Provider
- Choose a trusted JDK distribution, such as Oracle JDK or another reputable OpenJDK distribution.
- Open that provider’s official download page.
- Select the JDK version your project requires.
- Choose the Windows package that matches your PC’s architecture.
- Download the installer or archive provided by that vendor.
Avoid downloading Java installers from unrelated software-download sites.
3. Install the JDK
- Open the JDK installer you downloaded.
- Approve the Windows security prompt if you trust the publisher and expected the installer.
- Follow the vendor’s installation wizard.
- Note the installation directory if your development tools will need it later.
- Finish the installation.
The exact installer screens and default directory depend on the JDK distribution and version.
4. Verify Java and the Compiler
- Open a new Command Prompt or terminal window after installation.
- Run
java -version. - Run
javac -version. - Confirm that both commands report the JDK version you intended to install.
If java works but javac does not, you may have a path/configuration issue or may be invoking a different Java installation.
Do You Need JAVA_HOME?
Not every Java installation requires you to manually create a JAVA_HOME environment variable. Some IDEs, application servers, build tools, and scripts use it, while other tools locate Java another way. Set JAVA_HOME when your development tool or project’s documentation requires it.
How to Set JAVA_HOME When Required
- Find the JDK installation folder.
- Search Windows for Edit the system environment variables.
- Open Environment Variables.
- Create or edit
JAVA_HOMEso it points to the JDK directory rather than thebinsubfolder. - If your tool requires the JDK commands on PATH, add the appropriate JDK
binlocation or%JAVA_HOME%\binaccording to that tool’s instructions. - Open a new terminal and verify the version again.
What If the Wrong Java Version Appears?
Windows can have multiple Java versions installed. If the version commands show an unexpected release, inspect your PATH and any JAVA_HOME setting, then check the configuration inside your IDE or build tool. Removing older JDKs is not always necessary if a project still depends on them.
Summary
Choose the JDK version your project needs, download it from an official JDK provider, install it, and verify it with java -version and javac -version. Configure JAVA_HOME or PATH only when your tools require those settings.