This post describes how I install Java, Ant and Maven on my Windows PC, and how I setup the environment variables for development.

Install Java, Ant and Maven

When installing Java, Ant and Maven, I’m using “C:\opt” as basefolder, instead of the standard “C:\Program Files (x86)” directory.

Install Java, Multiple Versions

To install multiple java versions, I first uninstall any java installation from my PC, then i start installing the different versions, starting with the one with the lowest version number.

As install location, I’m used to change the default install directory, to have base path without spaces. As example:




After installing Java I set the JAVA_HOME enviroment variable, and I add the java binaries entry ( %JAVA_HOME%\bin ) to the path.

To test it is working, I type from command prompt :

The result is below

 Install Ant

The installation consists in download the latest binary, and unpack the file into a directory in my PC. As example:


After unpacking I set the ANT_HOME environment variable and I add the %ANT_HOME%\bin entry to the path

To test the setup, I type from command prompt:

The result are below

Install Maven

As for Ant the installation consists in download the latest binary and unpack the file on a directory. As example:


Then I set Maven environment variables, and I add the maven binaries (%M2%) to the PATH.

To test it, I type from command prompt:

The result is below

Environment Variables

Supposing we installed java in C:\opt\java\x86\jdk1.8.0_40 ; we unpacked Ant in C:\opt\apache\ant-1.9.4 and Maven in C:\opt\apache\maven-3.2.5,  we should have set the below environment variables:

We can test the tools are working using command prompt, as follows:

java -version
ant -version
mvn –version

Search for eclipse.plaform.ui in eclipse git repositories.

Click on project name to see the main page for the git project repository:

In this page are listed the commits. In the bottom left there are three alternative URLs for getting the source code. I choose the git one, then clone via command line.



The JSP Standard Taglibrary (JSTL) provides simple tags, encapsulating several core functionalities, to be added to any JSP application. As example, you can get tags to store and display variables, to make iterations, for XML manipulation, Input / Outputing , and so on.

This post explain how to setup a page with JSTL and make some examples for common tags.

Install JSTL

To use a tag library you need to import the jar libraries containing the implementation and define tags that invoke functions inside the library.

install JSTL by adding jar under lib folder

You can find jstl-1.2.jar on the web or from there: JSTL-1-2 (local archive).


Since the jat we’ve copied contains both libraries and TLD definitions, we can start to use JSTL tags. To use them, first we need reference JSTL with a declaration at top of JSP. In the shippet below we reference the jstl/core library, whose tags are available under the prefix “c:” .

Then we could put some JSTL tags inside the page.


In the snippet above we used

  • c:import to read a file on the server, and store content inside a varuable
  • c:out to output the content of a variable to the page (you could escape xml)

See the screenshoot below


To make some further test with the jstl/core we insert another two snippet, for loops. The first show a simple loop that build a table

The second list page parameters. Take care that param is an implicit Map object.


The result, obvious, are a table and a list. But instead to watch the picture,  you can build yourself.




This is a snippet of code to show how to perform an XSL transformation with Java

Below you can see how to XSL Transform using File, StreamSource and StreamResult.


And there it is an example of XSL Transform using StringReader and StringWriter.


Source code is available on my Git repository:


This article introduces mybatis java (iBatis 3 for java) and summarizes its configuration and usage. The article also give suggestions on its usage.



The iBATIS Data Mapper (born in 2002) is a framework that  introduces SQL Mapping approach to persistence layer development. The iBATIS name and code was donated to the Apache Software Foundation; that hosted project development for many years.

In 2010 the core development team of iBATIS has decided to continue development under the Google Code umbrella; then they switched to a new name: mybatis .

Actually mybatis is available both for Java and for .NET platform. Both the project teams forked their software to Google Code, on  mybatis Java and mybatis .NET . One of the best additions to the new version of the project it is the support for metadata annotations.

myBatis Configuration

building SqlSessionFactory from XML is quite simple:

The configuration file contains settings for the core of the MyBatis system



  • ${parameterName} : indicate a parameter, usually taken via propery file ..
  • mapper: imply the existence of the BlogMapper.xml file

myBatis Generator

For java guys it is also possible to generate XML files using the  myBatis artifacts generator,  available as standalone JAR; Ant task; Maven plugin or Eclipse plugin. See description on:, where you can get the JAR, and the Update Site for the Eclipse plugin.


Regular expression: sequence of characters representing a search pattern, to be used for operations like search and replace.

Standard Language

Regex, as we know them, are a standard adopted in many programming frameworks and languages, such as: Perl, Java, Javascript, Python, .NET, W3C XML Schema, etc. Generally there are only minos differences between languages.

Regex in Java

When using a regex in a Java application, I suggest to

  1. build the regexp according needs
  2. escape the regexp as java String.

See the examples below:


detect an email

The base regex is compound of three blocks:

  • account: letters, dots or numbers, representing the user
  • the @ character
  • provider: letters, dots or numbers, followed by a domain extension (.com, .net, etc.)

The base regexp look like this:

We will need to escape the “slash” and “dot” chars, to use the regex in java. The result is the following:

Usage of Regexp in Java

In java I can compile a regex to get a Pattern object instance, a compiled representation of the regex, built statically to match efficiently input strings.

The matched can be used to perform various operations on the String.

  • validate: tell if the String is compliant with the regex. As example you can validate user inputs, like an email address, a telephone number, or a postal address
  • replace : replace matching text
  • group: the regexp might define groups to be used for substring matching.


Simple example

Below there is the code for a matcher to match the filename extensions for xml, xsd and wsdl files


Advanced features

The advanced features i use more often are

  • groups – to match and capture a substring of the input
  • non capturing groups –  like (?:anything) – to improve performances


some examples you should know



  • Java Tutorial Essential – Regular Expressions : link
  • Vogella – Java and Regular Expressions : link
  • – Online Regex Tester : link
  • RegexPlanet – Regular Expression Test Page for Java : link
  • Optimizing Regex in Java : link
  • Mykong – 10 Java Regular expressions you should know : link
  • Example Depot – using a non capturing group in Java : link

Java regex matcher : link