Java ScriptEngineFactory Example

This example shows how to get the details of the script engines supported by your JVM. Java supports the different script engines that can be retrieved and used depends upon the client side scripts. Java provides javax.script.ScriptEngineFactory for storing all the script engine details like script engine name, version, default script engine, language, etc. You can use getEngineFactories() method in the javax.script.ScriptEngineManager to get the list of factories and the associated script engines. Lets look at the example.


import java.util.List;

import javax.script.ScriptEngineFactory;
import javax.script.ScriptEngineManager;

 * Java ScriptEngineFactory Details Example
 * @author Krishna
public class ScriptEngineFactoryExample {
	public static void main(String[] args){

		// Create ScriptEngineManager
		ScriptEngineManager engineManager = new ScriptEngineManager();

		//Get the ScriptEngineFactory List
		List list = engineManager.getEngineFactories();

		//Print the supported ScriptEngine Names

		//Print the supported ScriptEngine MimeTypes

		//Print the default script engine


[application/javascript, application/ecmascript, text/javascript, text/ecmascript]
Mozilla Rhino

Leave a Reply

Your email address will not be published. Required fields are marked *

Pin It on Pinterest

Share This

Share this post with your friends!