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 [...]

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.

Java Expiry Date header

Read how to set expiry date HTTP Header in Java webapps via configuration file without writing any code. This article shows you how to speed up your Java webapp by setting optimal expiration dates on your Java web pages.

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 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 [...]

Calling a static method from EL

This post shows how to call any static method from EL. You can also pass arguments to the method.

How to pass parameters in EL methods

How to pass multiple parameters in an EL function, in 3 simple steps.

Get Adobe Flash playerPlugin by wpburn.com wordpress themes