Internationalization with MessageFormat

In this post I want to show a quick example of how to internationalize your application in a easy simple way by taking advantage of MessageFormat class.
The design is fairly simple: for each single locale/language we have a properties file with translated messages. At the start we load the properties into a MessageGenerator object and [...]

Scripting in Java

Did you know that you can compile and run scripting languages like JavaScript, Python, Ruby and many others directly from your Java code? API responsible for it has been created as a result of Java Specification Request 223 and sits in the javax.script package.
Let’s see on a minimalist example how to use the Java Scripting [...]

A guide to Java SimpleDateFormat in examples

Today I want to show you some examples of how you can use SimpleDateFormat class in your code. I hope some of them will be new and surprising!
The basic example
First the most basic usage of the class. Lets use it to format Date object into a simple string showing day, month and a year:

SimpleDateFormat simpleDateFormat [...]