Java 7: New Feature – automatically close Files and resources in try-catch-finally

Try with resources is a new feature in Java 7 which lets us write more elegant code by automatically closing resources like FileInputStream at the end of the try-block.

New Java 7 Feature: String in Switch support

One of the new features added in Java 7 is the capability to switch on a String. See an example of how to use this feature and the pros of this feature.

Installing Java 7 on Mac OS X

While you can download the binaries for Java 7 for Windows and Linux, you need to go through a tedious build and install instructions for Mac OS X. This article links to the official Mac OS X Java 7 instructions, and also lists some things that are likely to go wrong and how to avoid them.

JBoss Tools bug: SeamListener not found

Overview If you use JBoss Tools Plugin for Eclipse to deploy apps to JBoss 5.1 container and get a “SeamListener not found”, this post provides a simple workaround. I deployed a webapp to JBoss 5.1 container from Eclipse using JBoss Tools plugin. The app failed to start with the following error: 19:01:14,762 WARN [JAXWSDeployerHookPreJSE] Cannot [...]

Securing a JBoss web application

This articles describes how to secure a Java web application in JBoss using BASIC authentication.

Access to www.w3.org DTDs blocked from Java

While parsing an XML file, I discovered that www.w3.org blocks requests to certain resources originating from the Java program, identified by the User-Agent. If your XML refers to w3.org DTDs, you might see an error like this: [java.io.IOException: Server returned HTTP response code: 500 for URL: http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent].

This is a known issue. The URLs have been deliberately blocked by w3.org due to ‘abusive’ use by Java programs.

Spring Quartz code snippets for beginners

Add cronjob like capability to Java web applications in 4 simple steps using Spring and Quartz. This article outlines the steps needed for scheduling, with code snippets for each step.

Java Barcode API

This article demonstrates how to read and write bar codes from a Java program. We use the open source library “zxing” which supports many different types of bar code including the 2D QRCode, used by mobile apps. It can even read a barcode embedded somewhere in the page in a busy text document.

How to display maven project version in your webapp

This article describes how to display the version of your maven project in your web application.

How to copy bean properties with a single line of code

This article shows how to copy multiple properties from one bean to another with a single line of code, even if the property names in the source and target beans are different. Copying properties from one bean is quite common especially if you are working with a lot of POJOs, for example working with JAXB [...]

Get Adobe Flash playerPlugin by wpburn.com wordpress themes