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.

How to download a file via HTTP GET and HTTP POST in Java without using any external libraries

Apart from uploading a file to a HTTP server endpoint, another common task for a Java HTTP client is to download a file from a HTTP server. Even though there are many Java external libraries to help us do so, using the facilities in the Java standard runtime installation is not difficult. Furthermore, we will be able to keep our Java application leaner if we can download files without additional dependencies.

In case you need a reference, this is how to download a file via HTTP GET and HTTP POST in Java without using any external libraries.

How to use Java to check whether a domain exists without any external libraries

You wanted to buy a domain for your personal website. You found a whois service and it told you that your domain is available. You are elated and tried to acquire the domain through your favourite registrar. However, your registrar told you that the domain had already been taken.

Isn’t that frustrating? Well, it happened to me once and I was determined never to use the whois service of those unscrupulous sites ever again.

So how can you check whether a domain name is available by yourself? When you have a computer at hand, you can find several ways to do so. In this post, I share how you can check whether a domain exists with the Java programming without using any external libraries.

Programming languages that you can use to build applications for Raspberry Pi, via Raspbian Stretch Lite

A programming language give programmers an interface to create computer applications to serve different use cases. On the other hand, a Raspberry Pi is one of the things that a programmer should consider getting.

Raspbian Stretch Lite is the official operating system for programmers to run server applications on a Raspberry Pi. You can use Raspbian Stretch Lite for applications that do not require a graphical user interface.

So what programming languages can you use for building applications for Raspbian Stretch Lite?

This post discusses some programming languages that you can use for building applications for Raspbian Stretch Lite.

How I setup Jenkins on my Raspberry Pi 3 with Raspbian Stretch Lite

Jenkins is a renowned open source automation server that can help offload programmers from performing repetitive tasks like:

  • running unit tests to make sure new code does not break existing codes.
  • compiling and packaging the binaries from codes and dependencies.
  • deploying new binaries to testing servers.
  • checking whether production server is up and running.
  • and etc.

If you have a Raspberry Pi 3 and you want to automate some of the tasks for your side projects, you may want to consider setting up Jenkins on your Raspberry Pi 3 with Raspbian Stretch Lite as the operating system.

This post documents how I setup Jenkins on my Raspberry Pi 3 with Raspbian Stretch Lite.

How to send an HTTP request to a HTTP Basic Authentication endpoint in Java without using any external libraries

One common task for Java developers is to write codes that communicate with API endpoints. Chances are these endpoints could use HTTP Basic Authentication for authenticating the HTTP request sender.

Although there are good libraries to help us craft and send HTTP requests to a web server in Java, I prefer to use the Java core library so as to keep my Java program lightweight.

Referencing my earlier post on how to construct a HTTP request to an endpoint with HTTP basic authentication, this post documents how to send an HTTP request to a HTTP Basic Authentication endpoint in Java without using any external libraries.

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.