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.

59 questions
0
votes
1 answer

scripting in Java via javax.script: cannot retrieve ScriptEngine for Python

I have a little maven project to learn about scripting in Java using javax.script API, namely JavaScript and Python. While JavaScript works well, like e.g. in this method @Test public void TestPrintHelloWorldJs() throws ScriptException { …
Kjara
  • 2,504
  • 15
  • 42
0
votes
1 answer

File with .SCRIPT extension - Not running in SQL

I have a file named "CreateDatabase1.script". I want to create a database from this file but this file is not executable in SQL Server management studio. How can I run this file and create this database??
Dhara Vaghasiya
  • 268
  • 3
  • 14
0
votes
1 answer

How to get the line number of an error when calling Kotlin from Java?

I'm trying to get which line is generating an error when calling a kotlin script from java. The following code gives line number -1. try { String scriptcode = "\n\nthrow Exception()"; ScriptEngineManager factory = new ScriptEngineManager(); …
nevcx
  • 541
  • 6
  • 9
0
votes
1 answer

Redirect stdout of KotlinScriptEngine in javax.script API

I am executing kotlin scripts using javax.script API. I want to capture the output and print the logs later. I am able to do this for nashorn script engine , but the same does not work on KotlinScriptEngine. public void testExampleNashorn()…
Abhinaya P
  • 244
  • 3
  • 13
0
votes
0 answers

How do I call a method from Java's ScriptEngine(javascript) staticly, with type parameters?

I am loading a class from a jarfile at runtime (because the script won't always use that exact jar), so I have a Class object of it. I am also doing that from javax.script.ScriptEngine (javascript). That class has the method public static User…
nickguletskii
  • 292
  • 4
  • 9
0
votes
4 answers

I am unable to evaluate string using eval()

I am trying to make a calculator application.I want to evaluate the contents of a TextView and display it as a toast message. The eval() statement throws an exception for ScriptException as below. "Unhandled exception: javax.script.ScriptException"…
0
votes
1 answer

Evaluating a string holding a logic operation as a Boolean in java

I am trying to evaluate "in1 && in2" to a Boolean as a test, but i hope to be able to evaluate all booleans as stings for my actual project. in1 and in2 are the names of nodes that have a boolean state, i get the actual expression like so, logic =…
James Oswald
  • 510
  • 3
  • 12
  • 25
0
votes
1 answer

Save an SVG image from a website using Java (desktop)

I'm generating a website with JDenticon using this code (test.html): Test