Category Archives: Java

Xpath Basics: Introduction to XPath with an Example Java Project

xpathXPath is a W3C recommendation used to search and find parts of an XML document through a path expression. The elements or attributes that match the path expression will be returned for further processing by the invoking command, module, actor, or component.

In this post, I will explain about the basic concept of XPath via presentation slides. The presentation starts with a revisit to some of the XML key concepts. Subsequently, it shows sufficient elaboration of the basic concept of XPath. It concisely describes the key features of XPath that are worth knowing and practically useful especially when searching inside XML files.

The final part of the presentation consists of a sample project accompanied with some screenshots provided for readers to experiment with. In an upcoming post, I will show how the sample project can be converted into a Maven project for more convenient use and distribution.

You can download the slides from the following URL:

Xpath Basics (2431 downloads )

Maven Tutorial for Beginners: Installation and Configuration

maven_windowsMaven installation on Windows is very straightforward. Nonetheless, this post will provide sufficient elaboration to ensure a smooth installation. Following the installation, some configuration and testing tasks may need to be completed prior to creating the first Maven project.

A prerequisite for Maven installation is Java JDK. If you have not installed the Java SDK, you can refer to the installation procedure explained in this post.

The installation and configuration steps are executed in order as follows:

1. Download Maven zip package from the download page

Maven download page URL is http://maven.apache.org/download.cgi.
In this post, we will install and configure Maven 3.2.3. It can be anticipated that the installation procedure of the newer version of Maven will be quite similar with the one explained in this article.

2. Extract the zip into an installation directory of preference.

In this article, the directory contained in the extracted zip package is moved into “D:\Devs\DevHome\Maven\Bundle\apache-maven-3.2.3”. There is no strict rule regarding the installation directory. You can put the Maven directory in any directory of your choice. Continue reading

How to Install Java SDK on Windows

java_windows_sA lot of Java-based development tools require Java SDK as the dependency. This post will provide the guide on how to install Java SDK from Oracle on Windows, especially Windows 7. An additional configuration step is also included so that Java will be immediately ready for use by dependent applications.

Java SDK installation on Windows is apparently very straightforward. Oracle already provides a page explaining the Java SDK installation steps. This post focuses on step-by-step guide with necessary snapshot images to deliver better clarity on the installation process.

Java SDK Installation

1. Download Java SDK from the download page

Java SDK download page URL is http://www.oracle.com/technetwork/java/javase/downloads/index.html.

Oracle has released Java JDK 8 that provides improvement over the previous Java JDK 7. However, in this post we will choose Java JDK 7 since some popular libraries that we will use later may have not officially supported Java 8. To download JDK 7, click JDK download button from the Java SE 7uXX section and choose the binary version to download (32-bit or 64-bit). Continue reading

Maven Tutorial for Beginners: Quick Introduction

Apache Maven logo

This is the first article of the Maven tutorial series for beginners. For those interested in building their Java projects on top of Maven structure, the articles in the series may help.

Preface

For Java developers, Maven is not an alien word. It is much known as a very powerful tool used to build and manage Java projects with varying size and complexities. Aside from being powerful, it is also pervasive, which is exhibited by substantial presence across projects and entities. It is used by individual developers whose projects are being shared in the public repositories to big enterprises with a walled garden protecting the codebase.

This article is targeted to Maven first-timers who are fiddling with Maven on Windows and are in need of guide to installing, configuring, and using Maven for their next Java project. Even though Maven can work across different versions of Windows, the articles and reference images were created in the environment as specified below:

Operating System: Windows 7
Maven version: 3.x.x
Java version: 1.7+

Continue reading

What Is Your Java IDE?

After a long break in posting in this technology blog, I will start sharing things with you again. This time, I’ll start with a simple topic: Java IDE. Following this post, I hope I can share lots more useful and exciting stuff for you.

I have been a long fan of Eclipse IDE. For some Java developers, Eclipse can be a religion that is taken for granted. There are obviously some reasons behind this. Eclipse is free thus saving the souls of those who really count each penny they spend for their toys. Additionally, its richness in third party plugins, which is an equivalent expression for broad range of support from software/API vendors, oftentimes make Eclipse the first choice of Java IDE.

Nevertheless, you may agree with me that one aspect Eclipse is lacking is the usability. When talking about usability, I don’t necessarily mean the interface is horrible. Eclipse is intuitive enough and it can satisfy most of your development needs, until one point where you think you should find another alternative. I have found out that Eclipse can be cumbersome when it is used for multi-module big Java projects. To be more specific, big, multi-module Java projects that use Maven for the build management instead of ant do not really play satisfyingly well under Eclipse.

Recently, I started using IntelliJ IDEA, an IDE from JetBrains. I don’t want to excessively praise this IDE but there are some rooms where this IDE rocks and beats Eclipse, severely and predominantly. In Eclipse for example, it is not straightforward to create a hierarchical multi-module POM-based projects. In contrast, multi-module hierarchical POM-based projects are easy to create in IntelliJ IDEA. IntelliJ IDEA’s intellisense, or auto-complete feature, is also awesome. The breadth of languages and XML structure it supports is unexpected. Coding Groovy in Eclipse can be non-intuitive but IntelliJ IDEA provides seamless intellisense support for Groovy. Even the POM file structure can easily created, modified, and analyzed with the builtin intellisense. The presence of this feature will undoubtedly increase your productivity. There are some other nice features but I will let you find them by trying this IDE by yourself if you haven’t got your hands dirty with it before.

Now, back to the original question. What is your Java IDE? And let’s make this question more interesting: What is the best Java IDE that you ever knew?