5 Tips to Overcome Big Data Security Issues

The importance of big data in today’s commercial world cannot be underestimated. Nearly all companies with an established presence online collect data that can unleash the full potential of business growth if well utilized. This is because the data can equip your business with valuable insights about your customers, which in turn helps you to strategize your marketing to increase...

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

How to read XML using SAX parser

In the previous article we talked about DOM parser and provided different examples for parsing and reading elements of an XML document. SAX parser is yet another XML parser provided by JDK which parses documents in a more optimized and faster way. SAX parser doesn’t load the whole document into the memory, however it parses the document line by line...

How to create XML file in Java

In this tutorial, we show how to create a new XML file using DOM parser provided by JDK. We’re going to create an XML called students.xml which lists students along with their basic information. 1- Create XML using Transformer The following code snippet appends 3 student elements to a root element called students and then transforms the document object to...

How to read XML file in Java

In this tutorial, we show how to read and parse an XML file using DOM parser provided by JDK. If you’re interested in SAX or STAX parser, please refer to these tutorials: SAX parser, STAX parser. 1- Students.xml Consider we have the following Students.xml file:

2- Instantiate XML file DOM parser loads the whole XML document into the memory and considers every XML tag...

ClassNotFoundException vs NoClassDefFoundError

ClassNotFoundException and NoClassDefFoundError occur when a required class is not found in the classpath at runtime. In this tutorial, we resolve the conflict between these 2 exceptions and explain the different scenarios of reproducing each one of them. 1- ClassNotFoundException As per java doc, this exception is thrown when trying to instantiate a class using one of these methods: forName(), findSystemClass(),...