Author: Hussein Terek

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...

How to modify XML using DOM in Java

Although the main purpose of XML documents is to store lightweight data for faster processing, they are still used in some small applications as a data store which requires dynamic modification. In this article we show how to modify an XML document using DOM in Java. You can still refer to previous articles which cover how to create and parse...

How to read XML using STAX parser

STAX is yet another parser for reading and parsing XML documents in Java, it is very similar to SAX where they both parse the XML document on call and provide events to the developer in order to handle each read tag separately, unlike DOM which stores the XML as a document in the memory. The main difference between SAX and...