Questions tagged [javax.script]

A scripting API consists of interfaces and classes that define Java Scripting Engines and provides a framework for their use in Java applications.

The javax.script package available in Java 6+ allows the definition and execution of text based scripts supplied from strings, URLs, Readers or InputStreams. A standard J2SE JVM includes support for JavaScript. Support for additional languages is available either programmatically or through the Java Service Provider mechanism.

Available language support includes:

These implementations are available at the java.net Scripting project website.

58 questions
16
votes
3 answers

How do I secure scripts run using javax.scripting?

I am using javax.scripting to add support for running arbitrary user-uploaded JavaScripts on the server-side. Obviously I want to secure those scripts! Rhino, on it's own, has a framework for securing scripts at runtime. The documentation for…
14
votes
2 answers

Trying to use Rhino, getEngineByName("JavaScript") returns null in OpenJDK 7

When I run the following piece of code, the engine variable is set to null when I'm using OpenJDK 7 (java-7-openjdk-i386). import javax.script.ScriptEngine; import javax.script.ScriptEngineManager; import javax.script.ScriptException; public class…
Yuval
  • 2,607
  • 25
  • 38
10
votes
2 answers

Calling Python from Java through scripting engine (jython)?

I'm trying to call Jython from a Java 6 application using javax.script: import javax.script.ScriptEngine; import javax.script.ScriptEngineManager; import javax.script.ScriptException; public class jythonEx { public static void main (String…
griffin
  • 2,938
  • 8
  • 34
  • 34
7
votes
1 answer

Rhino load() function available in JavaScript provided by javax.script?

Some JavaScript files that have been developed for Rhino's shell use load() to load additional JavaScript files. I'm attempting to embed functionality from one of these Rhino JavaScript files using javax.script. Unfortunately, the load() function is…
sutch
  • 1,145
  • 1
  • 11
  • 27
6
votes
1 answer

How can i use gems-in-a-jar with embedded JRuby?

I would like to use the excellent Sass as part of my build process. My build process is managed by Gradle. That means writing a plugin to run Sass. Sass is Ruby, and Gradle is in Groovy, but since Groovy runs on the JVM, i can use JRuby to run it,…
Tom Anderson
  • 42,965
  • 15
  • 81
  • 123
6
votes
2 answers

Can I create a 'window' object for javascript running in the Java6 Rhino Script Engine

I want to run some Javascript on my Java6 server - i.e. using the javax.script API, specifically the Rhino Script Engine. (Although another solution would be acceptable) The script file is created & supported by a third party, so I don't want to…
barryred
  • 1,071
  • 1
  • 16
  • 24
6
votes
1 answer

sqlite3 module for Jython

I'm using Java Scripting API to execute some external Python scripts from my Java application. The python scripts use sqlite3 module. Execution of the application is resulting in error ImportError: No module named sqlite3 As I look into the Lib…
kaychaks
  • 1,675
  • 3
  • 21
  • 28
5
votes
1 answer

Import a class in Scripting java (javax.script)

I want to import a class that I made in my project, into my script I did this but it doesn't work: function doFunction(){ //Objectif Mensuel importPackage(java.lang); importClass(KPDataModel.KPData.KPItem); //ERROR HERE, this is my class that…
Marouane Gazanayi
  • 4,733
  • 6
  • 35
  • 55
5
votes
1 answer

javax script how to call a function in JavaScript from Java

I'm trying to call a function in JavaScript via Java. This works fine when directly reading a script as a string but I'm using CompiledScripts. When I do this with a compiled script it gives me method not found if I also add bindings. Without…
sproketboy
  • 7,827
  • 17
  • 56
  • 81
5
votes
1 answer

ScriptEngine works in java String, but fails in String[]

The following code do the calculation for data in String rani=String rani = "32*0.25"; and gives the correct output as 8.0 import javax.script.ScriptEngineManager; import javax.script.ScriptEngine; import javax.script.ScriptException; public class…
Soon
  • 339
  • 2
  • 9
5
votes
4 answers

Java 6: Examples for implementing own scripting language using javax.script?

I really can't find good examples for implementing own scripting language using javax.script ... I need just something to start. Documentations Examples Tutorials Videos Presentations slides (PDF) Note 1: I'm really not talking about javascript…
ivan_ivanovich_ivanoff
  • 18,003
  • 24
  • 78
  • 100
4
votes
2 answers

ScriptEngineManager.getEngineFactoriesreturns no factories on appengine

The following code returns an empty array. import javax.script.Invocable; import javax.script.ScriptEngine; import javax.script.ScriptEngineFactory; import javax.script.ScriptEngineManager; import javax.script.ScriptException; ScriptEngineManager…
antony.trupe
  • 10,028
  • 10
  • 54
  • 81
4
votes
2 answers

Can you extend Abstract Java Classes from JavaScript?

I'm working on a project that makes really heavy use of the javax.script.* packages. I have a situation where I would like to create JavaScript objects that extend an Abstract Java Class, much like you can use Invocable.getInterface to make…
Jeremy Privett
  • 4,369
  • 2
  • 29
  • 35
4
votes
5 answers

How to use ScriptEngineManager in Android?

import android.widget.Toast; import javax.script.ScriptEngine; import javax.script.ScriptEngineManager; import javax.script.ScriptException; public void bEqual(View v) throws ScriptException { ScriptEngineManager mgr = new…
rrkjonnapalli
  • 109
  • 1
  • 6
4
votes
1 answer

SOS - Berlin scheduler cannot continue next job

I'm now migrating SOS scheduler from sun solaris to Oracle linux , SOS Berlin scheduler is latest version from 1.5.3253 - Linux X64 with Java JDK 1.7.0.45 - 64 bits Last time was using JavaScript but cannot be supported with 64 bits so I changed to…
crchin
  • 8,139
  • 6
  • 20
  • 27
1
2 3 4