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
1
vote
0 answers

Run javax.script.ScriptEngine with Python 3

I want to call classes/functions written in Python 3 from my Java library. For that, I tried to use javax.script.ScriptEngine;, but when I execute these lines: ScriptEngine engine = new ScriptEngineManager().getEngineByName("python")…
FiReTiTi
  • 4,748
  • 11
  • 22
  • 47
1
vote
1 answer

Efficient way to run multiple scripts using javax.script

I am developing a game where I'd like to have multiple scripts that all implement the same structure. Each script would need to be run in its own scope so that code doesn't overlap other scripts. For example: structure.js function OnInit() { //…
MetaCipher
  • 274
  • 2
  • 8
1
vote
1 answer

How do I retrieve Kotlin jsr223 script engine from ScriptEngineManager?

I'm trying to write an interface (GUI) to run some Kotlin scripts. I'm starting with just a Junit test to ensure that I can execute a script. I can't even load the kotlin engine. It seems like my dependencies (gradle) are in order, but you can…
Travis Well
  • 799
  • 5
  • 28
1
vote
2 answers

How to start a program via JavaScript from within a Java Application?

i have a little problem with starting a JavaScript (-file) from within a Java Application. I know the Application is startable through a simple Script if i put it into a sample.js. The actual call is as follows: new…
Gruber
  • 501
  • 1
  • 6
  • 15
1
vote
1 answer

What is the nature of a compiled script in JSR-223 context

I couldn't find any clear answer. Is the script translated to ByteCode ? to a script specific pseudo-code ? When i use a compiled nashorn script, is it simply compiled because the JIT compiler did its job on a java translation of the script OR…
xaevus
  • 53
  • 6
1
vote
1 answer

Using javax.script or Rhino to run javascript in Java with browser context (e.g. envjs)?

I am trying to run Protovis javascript from a Java program using javax.script: ScriptEngineManager factory = new ScriptEngineManager(); ScriptEngine engine = factory.getEngineByName("JavaScript"); engine.eval(new…
Shane
  • 92,684
  • 33
  • 219
  • 216
1
vote
1 answer

Setting InstructionObserverThreshold on javax.scripting context

I have been struggling with an issue using the java scripting API to control the execution of some user defined javascript. I am using the builtin Rhino engine under the hood, which says you can set the InstructionObserverThreshold and it will take…
Todd Patch
  • 268
  • 1
  • 4
  • 14
1
vote
3 answers

Interpretation of Java-code in Java based application - how to run java code in java program

I want to use Java TM Scripting Engines, but not with JavaScript. I want to use ScriptEngine for Java language. I found Article where all explains. But I can't run example. Maven dependency java-engine. Java TM Scripting Engines - supports many…
452
  • 366
  • 3
  • 7
  • 21
1
vote
0 answers

Javax date conversion

I am working in business application which allow custom scripting. Currently the Date object in the application show up as 2.0130725E7, may I know how to convert this into human readable format?
Jeno
  • 108
  • 1
  • 15
1
vote
2 answers

Does Fantom support JSR-223?

Does the Fantom programming language, either directly or via a third-party implementation, support JSR-223? That is, can Fantom be used to script Java objects via the 'javax.script' API?
Paul
  • 2,621
  • 13
  • 30
1
vote
1 answer

How to invoke a javascript having Jqueries using jdk 1.6's javax.script API's/Rhino Api's

I have a Javascript like below..