Find a tool to support BDD in Java environment

Behavior-driven development is a specialized version of test-driven development which focuses on behavioral specification of software units. Acceptance tests are written using the standard agile framework of a User story: "As a [role] I want [feature] so that [benefit]". Acceptance criteria should be written in terms of scenarios and implemented as classes: Given [initial context], when [event occurs], then [ensure some outcomes]. The goal is to find a tool for the Java environment to support the writing of scenarios, support for creating the java classes and methods for a scenario step.


integrate a Google Map into a Website using JSF

If you are implementing a Website using JSF and Java, and you want to add a Google Maps, there can be different solutions.

You can use one of the PrimeFaces components. There is a nice little component called GMap:
However it is doesn’t offer every function we are used to have with a Google Map.

A better possibility is to use gmap4jsf. To add a Google Mao into your JSF Page you need to add the gmaps4jsf tab library.
Here is a simple Example of who you can use it:

<%@ taglib uri="" prefix="m" %>

The Example in the attachment uses the latitude and longitude to present a marker on a specific point on the Google Map. The picture in the attachment presents the resulting outcome.

Further examples can be found using the following link:

The gmpas4jsf provides JSF tags that make it easy to create a map using latitude and longitude or an address. You can add a marker to the map or an information text. Also some nice additional function like a zoom in and out or switching between map types can be used.
You can read an overview about the functionalities of gmaps4jsf using the following link:

To calculate your coordinates you can use the Java API for Google geocoder v3
An overview about the functionality and also information about the Maven Repository can be found under the following link:
The geocoder is an easy possibility if you want to search for a specifiy city or route that you want to presents in your Google Map.


integrate a Google Map into a Website using JSF

The Challenge is to implement a Google Map into a Website. The should be option to add a mark on the map using for example the address or the latitude and longitude.

How to collaborate on a Java project

When working in team on a Java project, we want to be able to contribute to the code, even though sitting in different locations. The changes to the code should be synchronized, and it should be possible to comment on the recent changes.

Creating a Windows service for Glassfish


  1. Install a Glassfish Applications server from
  2. Open a Windows Command Line: Start Menu -> Run
  3. Change to your glassfish/bin directory

    cd $GLASSFISH/bin
  4. Execute the following command (for Glassfish v3):

    asadmin create-service --name "$SERVICENAME" $DOMAIN

    $SERVICENAME ... the name of your Windows service
    $DOMAIN... the name of your application domain in the glassfish
  5. Execute the following command (for Glassfish v2):

    C:\WINDOWS\system32\sc.exe create $SERVICENAME binPath= "$glassfish-root\lib\appservService.exe \"$glassfish-root\bin\asadmin.bat start-domain --user admin --passwordfile $glassfish-root\passwordfile $DOMAIN\" \"$glassfish-root\bin\asadmin.bat stop-domain $DOMAIN\"" start=auto DisplayName="$DISPLAYNAME"

    $SERVICENAME ... the name of your Windows service
    $DOMAIN... the name of your application domain in the glassfish
  6. Check if your windows service was created correctly and set to start automatically:
    1. Goto: Start -> Administrative Tools -> Services
    2. Right klick on your service and select properties
    3. Check if Startup typ is set to Autmatic
  7. Klick Start, to start the service

Commands (only Glassfish v3)

  • To start the service from commandline: /path/to/$SERVICENAME start
  • To stop the service from commandline: /path/to/$SERVICENAME stop

Starting glassfish with a Windows service

Glassfish is a Java Enterprise Edition application server. If it is installed on a windows server it is necessary start it automatically, for example after a maintenance reboot. To achieve this goal the glassfish startup process has to be performed with a windows service.

Java applets don't work on Mac OS X

All webpages that use Java applets show a "Missing Plug-in" error message. Safari & Firefox both don't work.

Using SoundManager 2 with GWT to play sound

Since GWT doesn't offer a native library supporting sound it is necessary to use an external gwt library. I ended up using GWT-sound, which in essence is a GWT wrapper of the JavaScript library SoundManager 2 that provides functionalities for playing audio.

To implement the audio player, the following steps were executed:
1. Create the GUI
2. Implement the GUI functionality
3. Implement the sound functionality
4. Initialize the audio player

For step 1 I created two buttons, one for play/resume/pause and one for stopping the sound file entirely:
Button play = new Button("play");
Button stop = new Button("stop");

Step 2 was implementing the functionality of the GUI, which in essence should just call the respective sound methods by a click on a button:
play.addClickHandler(new ClickHandler() {//onClick call play() or toggle()});
stop.addClickHandler(new ClickHandler() {//onClick call stop()});

To implement the audio functionality the class variable soundmanager was introduced that would handle the sound. SoundManager uses a String to identify a sound file:
SoundManager soundmanager = SoundManager.getInstance();
final String soundId = "id";

public void play() {;}
public void toggle() {soundmanager.togglePause(soundId);} //SoundManager uses same method for resuming and pausing
public void stop() {soundmanager.stop(soundId);}

In the last step it was necessary to load the sound file into the SoundManager and ensure the audio player wouldn't be played before the files were loaded. Otherwise it would result into an exception. For that purpose the buttons were disabled until the files were finished loading:
//disable buttons

//Assign the sound file to the soundmanager
sm.onLoad(new Callback() {
public void execute() {
soundmanager.createSound(soundId, "pathToTheFile");

//enable the buttons after the sound file is assigned
soundmanager.getDefaultOptions().onLoad(new Callback() {
public void execute() {
//enable buttons


Creating a web audio player with GWT

Google Web Toolkit (GWT) is a set of tools that allows for creating JavaScript applications in Java. For a web application I was working on with GWT, I had to create an audiovisualization unit. For that purpose it was necessary to implement an audio player that would play/pause/resume/stop a sound file by request.

Reading webpages in Java applications

Many web application fall into the category of "mash ups", meaning that they collect information from different sources (often other web applications) and combine it in a single, coherent user interface that offers additional value to the user. Often this additional value is enough to justify the mash up as a service of its own. In order write such an application, one must first be able to access the web pages in question in the Java code of the own application.


Subscribe to java