Questions tagged [java-scripting-engine]
14 questions
26
votes
4 answers
How can I determine if a variable exists from within the Groovy code running in the Scripting Engine?
How can I determine if a variable exists from within the Groovy code running in the Scripting Engine?
The variable was put by ScriptEngine's put method

ycomp
- 8,316
- 19
- 57
- 95
5
votes
1 answer
Nashorn: JavaScript expression evaluation throws class cast exception for function exposed using lambda
I have a following class with one variable of type Long
package com.nm.poc;
public class JSLong{
private Long longValue;
public Long getLongValue() {
return longValue;
}
public void setLongValue(Long longValue) {
this.longValue =…

Nitesh
- 97
- 1
- 10
2
votes
0 answers
Running Kotlin Scripts (.kts) with bindings from IntelliJ - unresolved reference: bindings
I am trying to run .kts scripts (using Script Engine) from a Kotlin program.
The Kotlin scripts reside in the resource folder of the project and normally they have support for auto-completion, IDE checks, auto-complete, etc.
The problem appeared…

Andrei Ciobanu
- 12,500
- 24
- 85
- 118
2
votes
1 answer
String expression interpolation support in java scripting engines
I'm using groovy/nashorn as java engine but not able to interpolate Strings.
jdk.nashorn.api.scripting.NashornScriptEngine scriptEngine =(NashornScriptEngine) factory.getEngineByName("nashorn");
ScriptContext context =…

Zizou
- 831
- 1
- 10
- 19
1
vote
0 answers
Using pandas and other libraries with Java's ScriptEngine
I'm running Python through Java's Scripting Engine. The basic hello world is working well, but it fails when I import pandas in the python script.
StringWriter stringWriter = new StringWriter();
ScriptContext scriptContext = new…

Palak Bansal
- 810
- 12
- 26
1
vote
1 answer
How to get OSGiScriptEngineManager running
I'm not quite a total newbie to OSGi, but apparently newbie enough.
What I want to do is write an OSGi (Apache Felix) bundle and use the Java scripting API (JSR-223) with for example Groovy. For this I installed groovy 2.4.12, which already is an…

tbeernot
- 2,473
- 4
- 24
- 31
1
vote
2 answers
ScriptEngine with name "nashorn" is null
I'm trying to create ScriptEngine with name "nashorn":
ScriptEngineManager manager = new ScriptEngineManager();
ScriptEngine engine = manager.getEngineByName("nashorn");
if (engine == null) {
System.out.println("engine == null");
}
But I…

Ksenia
- 3,453
- 7
- 31
- 63
1
vote
1 answer
Rhino: Ability to pause, save state and resume javascript
I'm using Rhino to interpret javascripts by Java. My use case requires these javascripts making (multiple) service calls (RESTful/Webservices/HTTP GET/POST). Some of these service calls are async in nature (with 24 Hours of SLA).
I want the ability…

ankitn
- 71
- 8
0
votes
1 answer
Can not call javascript rosnode module from java
I am trying to create a web application(in java) that can communicate with a ros server. Therefore I use the rosnode module.
For the website I use vaadin.
My problem is that I do not know how to call/execute the rosnode javascript based…

CoderOfTheForce
- 359
- 7
- 22
0
votes
1 answer
How in Java do I inject code during execution time?
I'm working on a java spring app which I need to provide the ability to add new code without altering standard code.
My challenges:
Store "custom" code in a database
Inject code at execution time into existing standard code
Isolate custom code so…

felix53
- 41
- 5
0
votes
1 answer
If I bind an object of one of my classes to a scripting engine, how can I access it as an object of that class from withing the scripting engine?
I want to be able to pass an object into ScriptEngine via put() and be able to access its properties and methods from within the scripting engine.
e.g
public class MyClass {
String getName() { return "abc"; }
}
MyClass my = new…

ycomp
- 8,316
- 19
- 57
- 95
0
votes
1 answer
Calling java script files synchronously failing in Microsoft Edge browser.
I have abc.html page in which i am calling two javascript files as below in the head tag:-
In my 1.js file i am loading 3.js file using ajax…

Vinay
- 705
- 2
- 7
- 22
0
votes
1 answer
Manipulating HTML nodes with java javascript scripting API
I'm using the Java Scripting API which is working quite well. Now I have a function where I want to get all tags from a String and then add/remove attributes before returning the manipulated String. The problem of course is, that I can't just…

msp
- 3,272
- 7
- 37
- 49
-2
votes
1 answer
Is there a way to run consecutive commands in python from Java?
What I want to do is, I have a semantic parser written in Java, and this semantic parser will output one-liner code in Python (string). And I want to make this consecutively. Methods I searched are runtime.exec or Jython where I can run the entire…

anton-sturluson
- 49
- 1
- 5