SrcCodes

Configure Simple Logging Facade for Java (SLF4J) with log4j as underlying logging framework

Simple Logging Facade for Java (SLF4J) is an abstraction of different logging frameworks (eg. log4j, java.util.logging, commons logging etc.). This tutorial describes how to configure SLF4J with log4j as underlying logging framework. To use SLF4J, it is required to include 3 jars SLF4J API (slf4j-api-x.x.x.jar)

Example to Generate Random Alpha Numeric Text

This example shows how to generate random alpha numeric text which is not easy to guess.

Dynamically create image from text using Java Servlet

This example shows how we can dynamically create an image from a text ('Hello World!') by writing a simple Java Servlet. In the next post, we'll see how this dynamic creation of image can be used to implement custom CAPTCHA validation.

How to retain DOCTYPE declaration while saving DOM Document to an XML file

If we save a DOM Document to an XML file using javax.xml.transform.Transformer, DOCTYPE declaration gets emitted by default. This example shows how we can retain PUBLIC and SYSTEM id of the DOCTYPE declaration for external DTD.

Programmatically Start or Stop an Application, deployed in IBM WebSphere Application Server (WAS) using Java Code and ANT script

This tutorial describes how an application, deployed in IBM WebSphere Application Server (WAS) can be started or stopped programmatically using Java code.

SrcCodes © 2026