Questions tagged [scriptengine]

Java's ScriptEngine system allows you to run/evaluate statements written in other programming languages like Javascript/ECMAScript, Python/Jython, and Tcl/Jacl.

227 questions
28
votes
5 answers

Java ScriptEngine supported languages

Java has a ScriptEngine system that allows you to run/evaluate statements in a different language. I know for a fact that JavaScript is supported, but I couldn't find any other languages to work with it. Is, for example, Ruby implemented?
user1241335
25
votes
4 answers

parse and execute JS by C#

i have simple crawler which crawl and search page. but now i have problem how to execute and parse js link from that page. Does anyone have any idea how to parse and execute js page? example: some_url is simple to parse with…
senzacionale
  • 20,448
  • 67
  • 204
  • 316
21
votes
2 answers

Using Rhino instead of ScriptEngine to run Javascript code in Java

Based on the discussion converting string representation of unknown date-format to Date in java, I want to use the JavaScript Date function in my App-Engine project. However, ScriptEngine does not work on App-Engine. So I need a little help…
learner
  • 11,490
  • 26
  • 97
  • 169
18
votes
1 answer

Major Performance Issues with Java 8 ScriptEngine Compared to Java 7

I have a Java program (compiled using JDK 7u80) which makes extensive use of the "JavaScript" ScriptEngine (JSR-223). I have noticed that my program runs extremely slow when executed under a Java 8 runtime environment (JRE 8u65) in comparison to a…
chrixm
  • 942
  • 6
  • 26
16
votes
2 answers

Nashorn alternative for Java 11

I am using the Nashorn JavaScript Engine in Java 11 which works fine except it will be deprecated soon. I have tried GraalVM which I find quite worse as it takes 13-14 seconds to execute a simple expression (e.g. 2+3). Is there any other alternative…
Sohaib Zafar
  • 183
  • 1
  • 1
  • 6
15
votes
1 answer

Use Javascript scripting engine in Java 17

I have to move a project from Java 8 to Java 17. I could solve most issues, but it contains a method, in which I use the ScriptEngineManager to evaluate a mathematical term. ScriptEngineManager mgr = new ScriptEngineManager(); ScriptEngine e =…
JustMe
  • 366
  • 1
  • 4
  • 14
13
votes
1 answer

Use a jar in JavaScript through Java ScriptEngine

I need to use classes from a jar file inside JavaScript. I'm using JavaScript through Java ScriptEngine and would like to do something similar to what I did with Jython here, import org.python.core.Py; import org.python.core.PySystemState; …
Kyle Bridenstine
  • 6,055
  • 11
  • 62
  • 100
12
votes
1 answer

With Java ScriptEngine (Groovy), how to make it more performant?

I am using ScriptEngine in my app to evaluate some client code in my application. The problem is it's not performant enough and I need to take measures to improve the time of execution. Currently, it can take up to 1463ms (average is around 300ms)…
matsientst
  • 620
  • 1
  • 9
  • 25
9
votes
3 answers

Nashorn ScriptObjectMirror JS -> Java type conversion

When I access a JavaScript object's member variable using Nashorn ScriptObjectMirror.get(), the returned object's type seems to be determined at runtime. For example, if the value fits in a Java int, get() seems to return a Java Integer. If the…
Ishan
  • 325
  • 2
  • 9
8
votes
0 answers

How can I force a Python ScriptEngine to flush its cache of imported modules?

I am using a Python ScriptEngine in my Java application to execute a Python script that imports various other Python scripts. Once the main script successfully completes and the eval method returns, I set the engine object reference to null and call…
Blaine
  • 81
  • 2
8
votes
4 answers

Reference javax.script.ScriptEngine in android or evaluate a javascript expression

Is it possible to reference the javax.script.ScriptEngine library when developing an android application? If not is there anyway possible to evaluate a javascript expression in android?
Tawani
  • 11,067
  • 20
  • 82
  • 106
7
votes
2 answers

ScriptEngine clear and dispose

My application uses a ScriptEngine to offer plugin-ability to my end-users. ScriptEngineManager engineManager = new ScriptEngineManager(); ScriptEngine engine = engineManager.getEngineByName("nashorn"); Whenever a user makes changes to his script,…
bvdb
  • 22,839
  • 10
  • 110
  • 123
7
votes
1 answer

Effective way to pass JSON between java and javascript

I'm fairly new to Nashorn and scripting on top of the JVM and wanted to know if I can get my java code and javascripts to communicate more effectively. I'm using a 3rd party JS lib that works with JS objects, and in my java code I have the data I…
Ronny Shapiro
  • 411
  • 3
  • 10
7
votes
2 answers

Debugging Java's ScriptEngine object

I started using the ScriptEngine for running javascript code. I find its very useful and good for my needs, but one thing is missing, and its debugging. How can i do it? I really wish to be able to just put a breakpoint or step-into and see the js…
buddy123
  • 5,679
  • 10
  • 47
  • 73
7
votes
1 answer

How to run UglifyJS2 without Node.JS

Anyway to run UglifyJS2 without node.js? Say I would like to run it in a JVM process using JavaScript script engine. How to do that?
Gelin Luo
  • 14,035
  • 27
  • 86
  • 139
1
2 3
15 16