Look at HelloPicking in the tutorials
then instead of initializing your ray with the cam direction use the coordinates of the tap
.....
Vector2f coord = new Vector2f(event.getX(),event.getY());
Vector3f origin = cam.getWorldCoordinates(coord, 0.0f);
Vector3f direction = cam.getWorldCoordinates(coord, 0.3f);
direction.subtractLocal(origin).normalizeLocal();
Ray ray = new Ray(origin, direction);
.....