Rhino is what you are looking for.
Rhino is an open-source implementation of JavaScript written entirely
in Java. It is typically embedded into Java applications to provide
scripting to end users.
Update:
Now Nashorn, which is more performant JavaScript Engine for Java, is available with jdk8.