ScriptEngineManager scriptEngineManager = new ScriptEngineManager();
//add any variables that you want accessible from the scripting engine
There are many uses to scripting, often games keep the entity logic in scripts that get called from the game loop. I use the scripting mostly to tweak and tune Box2D related variables without having to go through the edit/compile/restart cycle.
Here is a little example to give you an idea.
boidsIt = gameWorld.boids.iterator();
boid = boidsIt.next();
I added a simple interactive editor/console and here how a dev session for my Astroboids game looks like. And yes, I made some progress with my game, this is an actual screen shot of the game running.