private boolean isJavaScriptAvailable() { if(isJSAvailableChecked) { return isJSAvailable; } ScriptEngineManager mgr = new ScriptEngineManager(); List<ScriptEngineFactory> factories = mgr.getEngineFactories(); for (ScriptEngineFactory factory: factories) { List<String> engNames = factory.getNames(); for(String name: engNames) { if(name.equalsIgnoreCase("js") || name.equalsIgnoreCase("javascript")) { //NOI18N isJSAvailableChecked = true; isJSAvailable = true; return isJSAvailable; } } } isJSAvailableChecked = true; isJSAvailable = false; return isJSAvailable; }
OAF:
Example
try
{
ScriptEngineManager mgr = new ScriptEngineManager();
ScriptEngineFactory[] factories = (ScriptEngineFactory[]) mgr.getEngineFactories();
for (ScriptEngineFactory factory: factories) {
String[] engNames = factory.getNames();
for(String name: engNames) {
System.out.println(name);
}
}
}
catch (Exception e)
{
}
No comments:
Post a Comment