How to get the environment variables in Java
In Java, the System.getenv() returns an unmodifiable string Map view of the current system environment. If a requested environment variable is not defined, the System.getenv will return a null, and…
Favourite tutorials for developers
In Java, the System.getenv() returns an unmodifiable string Map view of the current system environment. If a requested environment variable is not defined, the System.getenv will return a null, and…
Normally, Java properties file is used to store project configuration data or settings. In this tutorial, we will show you how to read and write to/from a .properties file. The…
Few Java examples to sort a Map by its keys or values: (1) Uses java.util.TreeMap, it will sort the Map by keys automatically, (2) Yet another java.util.TreeMap example, provide a…
Java 8 Stream examples to sort a Map, by keys or by values. Steps to sort a Map in Java 8: (1) Convert a Map into a Stream, (2) Sort…
A series of Java 8 up to date tips and examples, hope you like it. Java 11 reached General Availability on 25 September 2018, this is a Long Term Support…
In Java, you can use System.getProperties() to get all the system properties. Also by sorting, you can display all the system properties in Alphabetical order.
This article shows a handy Java class that uses System.getProperty("os.name") to detect which type of operating system (OS) you are using now. This code can detect Windows, Mac, Unix, and…
In Java, we can use System.getProperty("user.dir") to get the current working directory, the directory from where your program was launched. The article shows different ways like File, Paths, FileSystems, or…
In this tutorial, we will show you three Java examples to construct a file path : (1) File.separator or System.getProperty(“file.separator”) (Recommended), (2) File file = new File(workingDir, filename); (Recommended), (3)…
In Java, the InputStreamReader accepts a charset to decode the byte streams into character streams. We can pass a StandardCharsets.UTF_8 into the InputStreamReader constructor to read data from a UTF-8…