With the older classes.jar from Lejos 0.8.5, the sensor does not work in Port 4.
The ultrasonic sensor fails to work if you query it too quickly. Wait 200ms between each query.
Also ensure that the distance to the next wall is less than 200cm during startup, since the automatic calibration might faile otherweise.
In my living room, the sensor returns very often random values, but in other rooms it works fine. I assume that the sensor is very sensitive to multiple reflections because my other sensor (SRF-02) works more stable in that room.