Author: Hussein Terek

How to solve org.codehaus.jackson.map.JsonMappingException: Unrecognized field

Jackson library is used with most REST/JSON applications in order to dynamically convert JSON to POJO and POJO to JSON. This tutorial explains how to solve the common exception raised by Jackson while doing the JSON/POJO conversion: org.codehaus.jackson.map.JsonMappingException: Unrecognized field This exception occurs when Jackson tries to map a JSON attribute to a POJO field and couldn’t find a setter method for...

How to implement an auto reloadable XML using Apache VFS

XML is usually used to store light configuration that controls the business flow or the layout of an application, it’s meant to be managed by business users in the production phase due to its simple human-readable syntax. A typical example is to store the default theme/layout of the application, control the accepted currencies of a financial application, turning on/off features...

How to convert a maven project to a non-maven project in Eclipse

Eclipse doesn’t provide a direct way to convert a Maven web project to a non-maven structure. In this tutorial, we provide an easy 2-steps way to do this. 1- Generate war file Suppose we have an existing maven web project with the following structure: In order to convert the above project to a non-maven structure, the first thing to do...

How to change the default deploy directory of Tomcat in Eclipse

By default, web applications are deployed under this path: “WORKSPACE/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps” . Here below we define the needed steps to change the default deploy directory of Tomcat in Eclipse. 1- Custom Deploy Directory Follow the steps below to change the default deploy directory of Tomcat in Eclipse. Open servers view Double-click on tomcat server, the following overview tab is opened: Select “use custom location”...

How to change the default deploy path of web resources in Eclipse

When developing a web application in eclipse, the default deploy path of java classes is “WEB-INF/classes” and every folder defined under WebContent is automatically deployed under the root path of the application. 1- Custom deployment path In order to set a custom deployment path for your resources in Eclipse, you can do the following: Right-click the web project -> properties Select Deployment...

How to serve static resources in a web application

In any web application, there exists a folder named WebContent that automatically holds .class and jar files. When running a web application in eclipse or when deploying a war file to an external Tomcat, all that Tomcat needs is the WebContent folder. In this tutorial, we show 2 ways for serving static resources in a web application. 1- WebContent The standard way for...

How IoT is changing the Enterprise Mobility Management (EMM)

Internet of Things is continuously changing the way we work or handle the businesses. The impacts are so powerful and fascinating that nobody can decline them. The connectivity is becoming so strong that it has almost captured every object coming in its outskirts. IoT is a wide network which aims at connecting the physical devices over the Internet. Any physical...

How to write to a plain text file in Java

This tutorial shows several ways to write content to a text file in Java. The techniques used below are pure JDK and don’t use external libraries. 1- BufferedWriter The most common and efficient way to write content to a file in Java is through using BufferedWriter as the following:

This technique is very efficient for writing huge data to...

How to read a plain text file in Java

This tutorial shows several ways for reading plain text files in Java. The techniques we use here are totally JDK built-in and don’t depend on external libraries. 1- BufferedReader The most common way for reading plain text files in Java is through using a FileReader wrapped by a BufferedReader. This technique is very efficient for reading large text files.

...

How to read input from console in Java

This tutorial shows several ways for reading input from a console in Java. Before listing the ways, it’s worth to define System.in as it’s used by most reading ways. System.in is a static field of type InputStream representing the stream which corresponds to keyboard input or any other input source specified by the host machine. 1- BufferedReader The oldest way...