Home » Core Java » apache » Page 5

apache

Write/Read CSV Files with Apache Commons CSV Example

In this example we will continue to demonstrate how to Write/Read CSV (Comma Separated Values) files in java. In our previous example, we already show how to do that using a native Java code. However, this example will illustrate how to write and read CSV files with an open source 3rd Party tool “Apache Commons CSV”, Apache Commons CSV library ...

Read More »

Build Java EE Application with Ant and Eclipse Example

Now, that we have understood the basics of ANT in the previous example, we can now proceed to use the same, for building a Java EE Application. A typical Java Web-Application involves cleaning the old compiled Class and WAR files, re-compiling the source files, packaging it, into a WAR and finally, copying it into the deployment of the respective Web/Application ...

Read More »

Building Java Application with Ant and Eclipse Example

Apache ANT (Another Neat Tool) is an open-source & highly flexible Build Tool used for automated compiling, updating, testing & deploying Java Applications.One major advantage of ANT is that, it does not enforce any directory layout or other such coding conventions. In this example, we shall show how to use Apache Ant (1.9) with Eclipse IDE, to build a Java Application. So without further ado, ...

Read More »

Create a simple BasicDataSource object

With this example we are going to demonstrate how to create a simple org.apache.commons.dbcp.BasicDataSource object, that is the basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. In short, to create a simple BasicDataSource object you should: Create a BasicDataSource object and configure the database. Use setDriverClassName(String driverClassName) method to set the jdbc driver class name. Use setUrl(String url) method ...

Read More »

Delete File from FTP Server

This is an example of how to delete a File from an FTP Server. We are using the org.apache.commons.net.ftp.FTPClient Class that encapsulates all the functionality necessary to store and retrieve files from an FTP server. Deleting a File from an FTP Server implies that you should: Create a new FTPClient. Use connect() API method to open a connection to the FTP ...

Read More »

Get list of files from FTP Server

In this example we shall show you how to get a list of files from an FTP Server. We are using the org.apache.commons.net.ftp.FTPClient Class that encapsulates all the functionality necessary to store and retrieve files from an FTP server. To get a list of files from an FTP Server one should perform the following steps: Create a new FTPClient. Use connect() API ...

Read More »

Establish connection with FTP Server

With this example we are going to demonstrate how to establish a connection with an FTP Server. We are using the org.apache.commons.net.ftp.FTPClient Class that encapsulates all the functionality necessary to store and retrieve files from an FTP server. In short, to establish a connection with an FTP Server you should: Create a new FTPClient. Use connect() API method to open a ...

Read More »

Download file from FTP Server

This is an example of how to download a File from an FTP Server, using the org.apache.commons.net.ftp.FTPClient Class, that encapsulates all the functionality necessary to store and retrieve files from an FTP server. Downloading a File from an FTP Server implies that you should: Create a new FTPClient. Use connect() API method to open a connection to the FTP Server. ...

Read More »

File Upload to FTP Server

In this example we shall show you how to upload a File to an FTP Server, using the org.apache.commons.net.ftp.FTPClient Class, that encapsulates all the functionality necessary to store and retrieve files from an FTP server. To upload a File to an FTP Server one should perform the following steps: Create a new FTPClient. Use connect() API method to open a connection ...

Read More »

Check if Days and Calendars match

With this example we are going to demonstrate how to check if Days and Calendars match. We are using the org.apache.commons.lang3.time.DateUtils Class, that is a suite of utilities surrounding the use of the Calendar and Date object. DateUtils contains a lot of common methods considering manipulations of Dates or Calendars. In short, to check if Days and Calendars match you should: ...

Read More »