Linux Tactic

Unleashing the Power of Java: Fundamentals Installation and Compilation

Introduction to Java

Java is a general-purpose programming language designed to facilitate software development. James Gosling, who initially created Java in 1991 for Sun Microsystems, deserves the credit for designing this object-oriented language, which is particularly famous in the software engineering sector.

Java syntax is readily understandable and simple, making it adaptable for both beginner and advanced coders. Java enables automatic memory management through garbage collection, which implies that programmers do not need to clear memory manually.

Java is also known for its design principle of “Write once, run anywhere”, meaning that Java code is platform-independent. In this article, we shall explore the fundamentals of Java and methods to verify and install the Java Development Kit in a system.

Features and Advantages of Java Language

As mentioned earlier, Java is an object-oriented language that supports inheritance, polymorphism, and encapsulation. Since Java’s syntax is relatively straightforward, students and new programmers can learn it without much difficulty.

Java is platform-independent, and its applications can be executed on any hardware, including Mac OS, Linux, and Windows. Java’s primary strength lies in its implementation of automatic garbage collection, in which the system manages memory automatically during runtime.

Garbage collection eliminates the need for manual memory management and reduces the chances of memory leaks and other problems. These features make Java an ideal language for GUI-based applications, enterprise applications, games, and mobile applications.

Verifying and Installing Java Development Kit

Before we begin, we must ensure that the Java Development Kit is installed on our system. Let’s explore the steps involved in checking for the Java Development Kit and installing it.

Checking for the Availability and Version of JDK

The first step in verifying if JDK is installed on your system is using the command-line tool. Open your Linux terminal, and enter the command:

javac -version

If JDK is installed, it will return the installed version of JDK. If not, it will show an error message stating that the tool could not be found.

If the JDK is not installed, download it from Oracle’s official download page and follow the instructions.

Downloading and Installing the JDK

To install Java Development Kit on your Linux system using the command line, enter the command

sudo apt-get install default-jdk

This command downloads and installs the default-jdk package, which includes the Java Runtime Environment and Java Development Kit. Once installation completes, verify if the installation was successful by rerunning the javac-version command.

The system should return the installed version of JDK.


Java is a dynamic and flexible programming language that continues to evolve with the changing technology landscape. Developers can use it to develop a wide range of applications, including enterprise, mobile, and web-based applications.

Installing JDK on Linux is a relatively straightforward process that helps coders run and compile Java applications on their systems. Java continues to hold substantial dominance in algorithmic, software engineering, and data science-driven industries, and is an ideal tool for any programmer aspiring to develop scalable, platform-independent, and robust applications.

3) Writing and Compiling Java Programs

Once we install the Java Development Kit, we can begin coding and compiling our Java programs. A Java program typically has three parts: a header that contains a defined package and imported classes, the body that holds the main code, and the footer that ends the file.

Creating and Saving Java Program File with .java Extension

You can use any code editor or Integrated Development Environment (IDE) of your choice to create a Java program. For example, using the Nano editor, you can run the command:


This creates a new file named “” with a blank document.

Next, type in the code, and save the file by pressing Ctrl + X, Y, and then Enter. Ensure that you include the .java file extension in the filename.

Compiling Java Program Using javac Command

Once you have created the Java file, you need to compile it into a class file. Use the command:


This compiles the code in “” to create a “testing.class” file.

The javac command checks the code for any errors and exports the class file.

Executing Java Program Using Its Class Name in the Terminal

To execute the Java program, type in the command:

java testing

This command runs the “testing” program’s main method in the terminal. It’s essential to use the exact class name when executing Java programs.

The execution should display any output that the program generates. It’s worth noting that programmers can use any IDE that comes with built-in features to create, compile and run Java code.

Such IDEs include Eclipse, NetBeans, and IntelliJ IDEA. 4)

Conclusion on Java Development

Java has come a long way since its creation in 1991, thanks to James Gosling.

It’s considered one of the most popular and widely used high-level languages globally, with its usage in software engineering, data science, and Android app development. It is a language that has stood the test of time and still innovating with new releases in the form of JDK packages.

Java’s simplicity is seen in its concise syntax and structure, which makes it a suitable language for beginners. It’s also an object-oriented language that follows standard design principles that make it better suited for large codebases.

In modern software development, Java plays a critical role in developing enterprise applications, mobile applications, and web-based applications, among others. Its object-oriented principles and robust libraries make it easier to work with than other languages like C++.

In summary, Java’s usefulness and simplicity make it a popular choice for modern software development. With its vast communities and continuously evolving technology, Java is an ideal tool for every programmer aspiring to build scalable, platform-independent, and robust applications.

In conclusion, Java is a prominent programming language with a straightforward and easy-to-learn syntax. Its object-oriented programming principles and automatic garbage collection make it ideal for creating robust, platform-independent applications.

To write and execute Java programs, we need to download and install the Java Development Kit, create the program file with a .java extension, compile the program using the javac command and execute it by running the class name in the terminal. Java has many uses in the software engineering industry, including mobile, enterprise and web-based applications.

Thus, Java is an essential tool for any developer who wants to create scalable, reliable applications.

Popular Posts