How to create war file using ant?

What is war file? WAR stands for Web application Archive. WAR is a compressed file format like the ZIP file which includes jsp, servlet, jar and static web resources etc in a specific hierarchical directory structure called WEB-INF. It is like jar file but follow a specific hierarchical directory structure. WAR files are deployed to … Read more

Categories Ant

How to create jar file using ant?

What is JAR file? JAR stands for the Java ARchive. Before discussing on JAR files let us discuss about ZIP file first. A ZIP file is file format which can store one or more files in the compressed format. ZIP files are most commonly used formats. JAR is also a compressed file format which normally … Read more

Categories Ant

How to use classpath in ant?

Ant provides the facility to create the classpath container which can be used later in a task. Let us understand it with the below example. In below example, we set classpath to “build.classpath” using path element. This classpath is used in the javac task of the compile target. In build.xml file: 1. src.dir: It specify … Read more

Categories Ant

how to create java document using ant in eclipse?

As we discussed all basic concepts of Apache ant, let us see the below example to create java project document using ant. In build.xml file: 1. src.dir: It specify the project source folder. 2. build.dir: It specify the project compilation output folder. 3. docs.dir: It specify the project document output folder. Example explanation: When we … Read more

Categories Ant

how to build java project using ant in eclipse?

As we discussed all basic concepts of Apache ant, let us see the below example to build java project using ant. In build.xml file: 1. src.dir: It specify the project source folder. 2. build.dir: It specify the project compilation output folder. Example explanation: When we run the build.xml file, control first go on the project … Read more

Categories Ant

JAXB unmarshalling – convert xml into java object example

Unmarshalling is the process of converting xml into java object. The unmarshal() method of JAXB Unmarshaller is used for unmarshalling process. Steps: 1. Create a pojo class. 2. create JAXB context instance. 3. Create Unmarshaller instance using JAXB context. 4. Call unmarshal() method for unmarshalling process. 5. Process the pojo object. Example explanation: Below example … Read more

JAXB marshalling – convert java object to xml example using multiple pojo

Marshalling is the process of converting java object into xml file. Let us discuss JAXB marshalling process with below example. The marshal() method of JAXB Marshaller is used for marshalling process. Steps: 1. Create a pojo class. 2. create JAXB context instance. 3. Create Marshaller instance using JAXB context. 4. Call marshal() method for marshalling … Read more

JAXB marshalling – convert java object to xml example using one pojo

Marshalling is the process of converting java object into xml file. Let us discuss JAXB marshalling process with below example. The marshal() method of JAXB Marshaller is used for marshalling process. Steps: 1. Create a pojo class. 2. create JAXB context instance. 3. Create Marshaller instance using JAXB context. 4. Call marshal() method for marshalling … Read more

How to add password protection to PDF using iText in Java?

The PdfWriter class provides the setEncryption() method to set the password protection on a pdf file. Syntax: public void setEncryption(byte[] userPassword, byte[] ownerPassword, int permissions, int encryptionType) throws DocumentException. 1. userPassword – It specify the user password. 2. ownerPassword – It specify the owner password. 3. permissions – It specify the user permissions. 4. encryptionType … Read more

How to modify an existing pdf file in java using iText jar?

To modify an existing pdf file using iText jar first download the iText jar files and include in the application classpath. Steps: 1. Create PdfReader instance. 2. Create PdfStamper instance. 3. Create BaseFont instance. 4. Get the number of pages in pdf. 5. Iterate the pdf through pages. 6. Contain the pdf data using PdfContentByte. … Read more