Articles about Java

The Java programming language is a popular object-oriented programming language that is used for creating many server and mobile applications in the world.

In this page, you will find articles relating to Java. Some of the topics include Java references, Java coding and Java application setup.

Things about the Object class in Java that programmers ought to know about

After getting started with Java development, getting to know the Object class well is one of the next steps that programmers should undertake to be proficient with the Java programming language. This post lists some points about the Object class in Java that programmers ought to know about in order to code well in the Java programming language.


Ways to implement the Singleton pattern in Java

After you got started with Java programming, chances are you will want to use some design patterns to organise your Java classes.

One common object oriented design pattern is the Singleton pattern. The Singleton pattern is a technique where you can apply to ensure that there is only one instance of your Java class per runtime.

The Singleton pattern is usually used for grouping functionalities that allow callers to act on a single set of state. Examples of cases where the Singleton pattern can be applied include:

  • A class that keeps track of a customized configurations from a configuration file.
  • A class that facilitates interactions with a database system.
  • A class that performs logging.
  • A class that caches data read from previous database calls.

This post documents some ways to implement the Singleton pattern in Java.

Getting started with Java programming

The Java programming language is a powerful tool for people to get computers to help perform work on behalf of humans. Since its inception, it had been well adopted by many companies in the creation of many great services and technologies.

This post is for my younger self and people who wanted to get started in learning Java programming but find it hard to get started.

How to manually create the jar file for running your Java application

Advances in software engineering had shortened the time needed to build an application from scratch. For instance with Spring Boot, I can easily build my own web API backed by a web server of my choice into a single jar file. By running that jar file, I can start a process that responds to HTTP requests directed at my customized endpoints.

However, not knowing how that jar file is formed and read by the Java Virtual Machine can cloud our understanding of application development with Java. To help understand Java application development better, I described how to manually create a jar file for running a Java application.

How I make my Java programs run faster on my Raspberry Pi 3

When my first attempt to install GitBucket on my Raspberry Pi 3 highlighted to me that it was the JVM that caused GitBucket to have sluggish performance, I did not invest more time to improve the performance of the JVM that I had installed on my Raspberry Pi 3. Instead, I went on to install Go Git Service on my Raspberry Pi 3 to act as the Git server to manage the source codes of my hobby projects.

However, I just couldn’t get over my belief that Java programs would perform badly on my Raspberry Pi 3; after all Java was the first programming language that I learnt and I often use it to build software at work. Furthermore, with an Ubuntu Server 15.10.3 setup on my Raspberry Pi 3, I could use my Raspberry Pi 3 as an integration server for my Java hobby projects and be pretty sure that if my Java hobby projects run on my Raspberry Pi 3, they will most probably run on a Ubuntu Server 15.10.3 DigitalOcean droplet as well.

After spending some time researching the topic, I did manage to make my Java programs run around 10 times faster on my Raspberry Pi 3. This post documents the steps that I went through to speed up my Java programs on my Raspberry Pi 3.