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?
Java History
Before starting the discussion about OpenJDK, let us recall a few things about Java. Java is one of the most popular languages in use today, with an estimated 12 million developers using it globally. The Java language is a versatile, cross-platform language that was developed by James Gosling at Sun Microsystems in the year of 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 a lot of enterprise applications scrambling to figure out how to avoid paying Oracle millions in support fees. The easiest solution, of course, was just 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 |
Published On: | www.softwaretestingo.com |
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 any fees.
If you choose to use OpenJDK, be aware that it is not supported by Oracle which means that there are no support options available from Oracle and may lack some of the commercial features available in the proprietary version.
How to download OpenJDK For Windows
If you’re looking to get started with Java 18, head over 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:
Install OpenJDK
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 on Edit the system environment variables, you will get a window System properties.
Click on the Environment Variables, After that you will get another environment variables window. Click the New button under the System variables section to add a new system environment variable.
In order to set up OpenJDK, you’ll need to add its home directory to your system variables. To do this, simply 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.
The next thing is to click on the “Path” variable under the “System variables” section in the Environment Variables window. Clicking on 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 you see 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 Click the “OK” button in the “Environment Variables” window to save your changes.
OpenJDK Verify Command
To Verify if the OpenJDK is installed correctly or not in your local machine you have to 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.
Conclusion:
If you follow the steps in this tutorial, you’ll be able to download and install OpenJDK in no time! If you have any questions or concerns, just let us know in the comments section.
Leave a Reply