If you’re curious about OpenJDK and want to learn more, this blog is for you. We’ll cover what OpenJDK is, its history in relation to Oracle JDK, How to Install it on your local machine, and much more. We have also shared a detailed blog post on How to Install Java on Windows machines and how to configure the System Variables.
Before starting the discussion about OpenJDK, let us recall a few things about Java. Java is one of the most popular languages today, with an estimated 12 million developers using it globally. The Java language is a versatile, cross-platform language that James Gosling developed at Sun Microsystems in 1990.
In 2006, Sun Microsystems decided to release Java under the GPL. In November of that year, most of the source code for Java was made available to the public. This initial release included the Java Virtual Machine and the ‘javac’ compiler. These components allowed Java developers to write and run code against a free and open-source platform.
There’s no denying that Oracle made a huge splash in the Java community when they switched Oracle JDKs to paid services in 2019. This left many enterprise applications scrambling to figure out how to avoid paying Oracle millions in support fees. The easiest solution, of course, was to pay up and stick with the existing architecture. However, there is an alternative: open source. Making the switch could help you avoid those pesky support fees altogether.
|Post On:||How to Install OpenJDK On Your Local machine?|
|Post Type:||Java Tutorials|
|Applicable For:||Freshers & Experience|
|Get Updates:||SoftwareTestingo Telegram Group|
Alternative of Java
OpenJDK can be thought of as “free” Java. You can acquire it easily and redistribute it without worrying about license obligations, making it an excellent choice for developers who want to create Java applications without paying fees.
If you choose to use OpenJDK, be aware that it is not supported by Oracle, which means there are no support options available from Oracle, and it may lack some of the commercial features available in the proprietary version.
How to download OpenJDK For Windows
If you want to start with Java 18, head to the OpenJDK official download page at https://jdk.java.net/18/. Once you’re there, click on the Windows/x64 binary bundle download link as shown below:
Unzip the downloaded file to your chosen location. I extracted mine to C:\Users\XX\Downloads\DL_Files\openjdk. The final path should be something like C:\Users\XX\Downloads\DL_Files\openjdk\jdk-18.0.2.
Note: Please ensure that the final path does not contain any spaces. This is the only step required to install OpenJDK on Windows.
Set Environment Variables
We’ll need to set some environment variables in order to use the OpenJDK from the Command Prompt. To do so, follow the below steps:
- Click on the Search bar and Try to Find out the environment variables.
- Click on the Edit the system environment variables result.
After clicking Edit the system environment variables, you will get a System Properties window.
Click on the Environment Variables; you will get another environment variables window. Click the New button under the System Variables section to add a new system environment variable.
To set up OpenJDK, you must add its home directory to your system variables. To do this, enter JAVA_HOME as the variable name and the path to the OpenJDK folder as the variable value. This will help ensure things run smoothly, and click OK to save the new system variable.
Next, click on the “Path” variable under the “System variables” section in the Environment Variables window. Clicking the “Edit” button will allow you to edit the variable.
Click the New button in the Edit environment variable window. Enter %JAVA_HOME%\bin into the new field. Click OK to save changes to your Path variable.
Note: If the error ‘javac’ is not recognized as an internal or external command, operable program, or batch file, it may be because you have not added the path to the Java home directory to your Path variable.
Again, save your changes by clicking the “OK” button in the “Environment Variables” window.
OpenJDK Verify Command
To Verify whether the OpenJDK is installed correctly in your local machine, you must run the java -version command.
After running the java -version command, if you are getting the version details, then that means that your environment variable is set correctly and the OpenJDK installation is successful.
If you follow the steps in this tutorial, you can download and install OpenJDK in no time! If you have any questions or concerns, just let us know in the comments section.