Read property file from resource folder or directory in java (with example)

Given a property file defining the properties of a java application. Property file will be residing in the resource folder/directory. Load the property file present in resource directory. Load property using Properties class in java. Properties class extends Hashtable. Hashtable will provide properties as key value pairs.. We will iterate through key / value pairs… Read More »

Thread join example using Runnable interface in java

Create a task by implementing Runnable interface. We will demonstrate join method and its impact on execution on multiple threads. We will write couple of methods demoThreadJoin: Method will create multiple threads. Output of a method will demonstrates the execution of join method. Threads will execute one after another (i.e. thread-1 to thread-4). demoWithoutThreadJoin: Method… Read More »

Print / list all fonts & font family using java (example)

List all system fonts and font families using GraphicsEnvironment. We will iterate through system fonts and we will print the desired attributes. Program – get or list all system fonts & font’s family using java (example) package org.learn; import java.awt.Font; import java.awt.GraphicsEnvironment; public class AvailableFonts { public static void main(String[] args) { GraphicsEnvironment gEnvironment = GraphicsEnvironment.getLocalGraphicsEnvironment(); Font[]… Read More »

Print or list all environment variables using java8 streams

We will get list of all environment variables using System class. We will iterate through the map of system variables using java8 streams. Program – print all environment variables using java8 streams. package org.learn; import java.util.Map; import java.util.Properties; public class ListEnvironmentVariables { public static void main(String[] args) { Map<String, String> mapEnvVariables = System.getenv(); System.out.println(“Environment variables are… Read More »

Print or List locales, country codes / names / languages using java8

In current post, we will print /displays locales, country codes, country names and country languages. We will use Locale class to retrieve available locales. We will iterate through the locales using java 8 streams (and we will print the desired information). Program – list locales, country codes/names/languages (java8 streams). package org.learn; import java.util.Arrays; import java.util.Locale;… Read More »

Page 4 of 41« First...23456...102030...Last »