Java Programming Languages

Java is a powerful, general-purpose programming language used to develop mobile, web applications, desktop applications, games, etc. Java is Cross-platform thus can be used in any platform like Windows, macOS, and Linux. It is one of the most popular programming languages which makes it easy to learn with many resources available together with large community support. It is object-oriented, making its structure clear and allowing code to be reused.

 Java Development Kit (JDK) is a development environment for building applications. Its components include development tools, libraries, runtime environment, source code, Java DB, and Documentation.

In this guide, we’ll be working with Eclipse Temurin JDK from Eclipse Adoptium Project and Working Group.

Eclipse Temurin

Eclipse Temurin is a free OpenJDK distribution that provides codes and processes that support the building of high-quality OpenJDK-based binaries used by enterprises in embedded systems, desktops, traditional servers, large mainframes, and modern cloud platforms.

 Features

  • Temurin builds are TCK certified
  • Runtimes and Development Kits: supporting the breadth of APIs specified by various versions of Java SE, and available on a wide variety of processor architecture and operating system combinations.
  • TCK Testing Infrastructure: providing infrastructure for running Java SE TCKs to ensure compliance and compatibility.
  • JDK Mission Control: low-overhead profiling and diagnostics tools suite for the JVM.
  • Installers and repositories: various mechanisms for obtaining and managing the installation of runtime technology, such as platform native installers, container images, download servers, a website, and artifact repositories.

In this guide, I will show you how to Install Temurin on Windows and create and run a sample application.

Install Temurin OpenJDK 17 on Windows 11 / Windows 10

Navigate to Adoptium.net to download the latest version of the Temurin LTS Windows installer. Click on the Latest release and the download starts immediately.

Find the setup and click to start the installation. It opens the setup wizard

The next thing will be to choose the features to install. Here is where you set the JAVA_HOME environment variable. Select on the option then click on “will be installed on local hard drive“. Do the same to registry keys and then click Next.

Click on Install to continue with the installation

The installation finishes successfully, Close the wizard

To check the installation was successful, use the following command on your Command Prompt.

java -version

It will display the version of the JDK as shown below.

To check if the path JAVA_HOME was set correctly, use the following command

echo %JAVA_HOME%

It will display the directory as shown

Create a Sample Application

We will use a text editor to append the following code. I used Notepad++.

class Hello{
    public static void main(String[] args) {
        System.out.println("Hello from Texhnixleo. Hope you are doing just fine."); // Display the string.
    }
}

It appears as below.

Save the file in a folder easy to access. I saved mine in a Java folder on the desktop as shown below

Open your command prompt and change your directory to the java file. For me, I would navigate to Desktop/Java

cd Deskktop/Java

Then Build the application using the following command. Note the case as Java is case-sensitive.

javac hello.java

This will create the .class file Hello from our code.

Then run the program using the following code

java -cp . Hello

The Output is as follows.

Conclusion

In this guide, I have taken you through the process of installing Temurin 17 LTS on windows using the windows installer. The process is pretty much straightforward and easy to go about it. I have also shown you how to create a sample java application and run the program using the command prompt.

LEAVE A REPLY

Please enter your comment!
Please enter your name here