Questions tagged [nashorn]

Nashorn is an open-source, JVM-based JavaScript engine. It replaced the Rhino JavaScript engine starting in Java 8.

Filter by
Sorted by
Tagged with
0 votes
0 answers
15 views

How to use NashornSandbox in safe way

I am using the following code to execute the statements NashornSandbox sandbox = NashornSandboxes.create(); String input = "(20>=10 && 19<=20 || 33>30 ) && ...
MIX 2000's user avatar
0 votes
0 answers
32 views

Unable to view variable value from IDEA using Nashorn engine

I am unable to see the variable value from the debug window in IDEA (2023) when I try to debug some JS code. The only thing shown is the message 'Collecting data...' and the Evaluate expression is ...
SilverLuke's user avatar
1 vote
1 answer
66 views

NetBeans 19 Java 17 Remote Debugging Raspberry Pi Not Working Without Nashorn

I'm trying to upgrade a development environment from NetBeans 12.6 to 19 and Java 11 to 17 on Windows 10. This environment supports an application targeted to both Windows and Raspberry Pi OS. After ...
Blaine's user avatar
  • 31
0 votes
0 answers
33 views

How to post a file to url without saving the data to disk?

Note: I am running the following code in Nashorn. I have a file downloaded by the application and the raw content stored in a variable encoded in base64, and I want to send this over http in a ...
user2360915's user avatar
  • 1,099
0 votes
0 answers
119 views

Try to run a JavaScript file with Nashorn, failing due to problems with import/const/require

I need to add a new feature to my Java-8-based application (can't upgrade Java) where it takes an encoded string and decodes it to a JSON. The issue is that that decoding library is written in ...
edoreld's user avatar
  • 303
5 votes
3 answers
181 views

Google Cloud Dataflow error NoSuchMethodException: No such function

I am using a dataflow function to transform pubsub messages in the form of json written as a string to submit into a bigquery table with the correct schemas in place. I use the following UDF function ...
Panda's user avatar
  • 91
0 votes
0 answers
140 views

getEngineFactories() returns an empty list

I need to execute JS code in Java (JDK 18). To do this, I want to use the ScriptEngine class with the engine "Nashorn" (or any other capable of executing Javascript) using the constructor ...
Adam's Apple's user avatar
0 votes
0 answers
37 views

String concatenation is not happening in JS SpiderMonkey

I have a deployment environment where I am running my JS codes in SpiderMonkey JS engine. I had to do some conversion from HEX to ASCII. I am iterating through a HEX string and concatenating to a ...
gunescelil's user avatar
2 votes
0 answers
363 views

Unable to create javax script engine for javascript in Extjs

It seems that the Nashorn engine has been removed since JDK15 https://openjdk.org/jeps/372 But I don't want to downgrade the JDK to build the Sencha app. Do you have any suggestions? Thanks! I also ...
Eka's user avatar
  • 21
0 votes
0 answers
64 views

How to convert objects back and forth between JS and Java in Nashhorn with structural equality?

I have a JS object that I must pass to some Java class' method. That method mutates values. I want the object back in JS form after the operation. Essentially, how do I satisfy the identity function ...
cdaringe's user avatar
  • 1,294
0 votes
0 answers
78 views

Access to Global data/functions in Rhino from a listener

I'm using MagicDraw/Cameo's Scripting engine to create Role-based UI's for non-SysML users. They were developed (successfully) using Nashorn, but the newest Cameo is using Rhino. The migration breaks ...
Buddy Robbins's user avatar
0 votes
0 answers
74 views

How to pass a Java byte[] to the ScriptEngine Nashorn as parameter

This is my code to call a JavaScript function in Java: // create a script engine manager ScriptEngineManager factory = new ScriptEngineManager(); // create a JavaScript engine System.setProperty("...
Hanabi's user avatar
  • 637
1 vote
1 answer
567 views

IntelliJ/PhpStorm - How to use IDE scripting engine as a GitHub Copilot completion capture/fix?

I've been trying to find any type of documentation or examples on how to use the "IDE scripting engine" (or other quick methods of enhancing PhpStorm/IntelliJ IDEs) and found literally ...
John's user avatar
  • 7,587
0 votes
1 answer
169 views

How to add the Nashorn module to Tomcat 10

I want to add the Nashorn module to my Tomcat 10, but I haven't found a way how to do that. I am using OpenJDK 19. I downloaded the Nashorn jar file from here: https://search.maven.org/artifact/org....
Simon42's user avatar
0 votes
1 answer
1k views

How Can we use Nashorn with Java 17? [duplicate]

I know that, Java Nashorn has been removed onwards java 15. I want to know, how can we use external openjdk nashorn engine(https://search.maven.org/artifact/org.openjdk.nashorn/nashorn-core/15.0/jar) ...
Sandushi Dileka's user avatar
1 vote
2 answers
234 views

Getting "speechSynthesis" is not defined in jjs(Java JavaScript)

I am attempting to access the SpeechSynthesis interface for speech service with the help of the Nashorn engine in java. Is it possible to import or create a similar SpeechSynthesis interface to the ...
Annamalai Palanikumar's user avatar
1 vote
0 answers
2k views

The import jdk.nashorn cannot be resolved

I am trying to import a project into my eclipse workspace. When I maven updated the project, this dependency is not getting downloaded. When I searched online, I found that jdk.nashorn is not ...
Vijay's user avatar
  • 21
1 vote
0 answers
186 views

Nashorn with open-jdk 11.0.1 throws java.lang.StackOverflowError

I have a Java Application that uses open-jdk 11.0.1 “2018-10-16” to build/run the application. While opening the application, it tries to use the system's proxy configuration. For some PAC scripts it'...
Mandeep Y's user avatar
2 votes
0 answers
242 views

How to fix GraalVM Warning: Unable to create a system terminal, creating a dumb terminal

I just downloaded and install the latest graalvm, got the warning while run js what I'm missing yet, how to avoid it? C:\>java -version Picked up JAVA_TOOL_OPTIONS: -Dnashorn.args=--no-deprecation-...
Ostap Bender's user avatar
0 votes
1 answer
36 views

Nashorn--Only one class is used to get its bytecode

Nashorn,"Java.extend function returns a type object for a subclass of the specified Java class (or implementation of the specified interface) that acts as a script-to-Java adapter for it." I ...
BangBang's user avatar
0 votes
2 answers
423 views

How to manage user groups with the Polarion ALM API in workflow scripts

I am trying to add a user into a global group with global role in Polarion using workflow script by providing an input. Can you please help me how to call the below packages into workflow script? com....
Nayudu's user avatar
  • 1
1 vote
1 answer
475 views

How do I remove ScriptObjectMirror(jdk.nashorn.api.scripting.ScriptObjectMirror) since it is Deprecated?

I have recently started working on this new project where we are decoding our message using ScriptEngine & ScriptEngineManager. Here we have used ScriptObjectMirror which is deprecated from JDK 11 ...
JustAnotherNoob's user avatar
1 vote
1 answer
395 views

Standalone Nashorn giving java.lang.NoClassDefFoundError: jdk/dynalink/RelinkableCallSite using java 11

I was using nashorn built-in java 11, but i need functionality from newest standalone version. However, when i'm using ScriptEngine engine = new org.openjdk.nashorn.api.scripting....
Kontaro's user avatar
  • 51
0 votes
0 answers
21 views

How to invoke Java function multiple times from inline Javascript Expression using ScriptEngine [duplicate]

I am evaluating an inline Javascript Expression using Java 8's ScriptEngine. Example Expression (_tranxAmount > 100) && (profile.received('daily', 'avg', false) < 100) Where profile is ...
Afridi's user avatar
  • 6,793
2 votes
1 answer
1k views

Standalone Nashorn with Java 11 throws java.lang.StackOverflowError upon eval

I came across an issue with Nashorn, when evaluating a large expression, it works fine in Java 8 , but throws a java.lang.StackOverflowError in Java 11. Exception in thread "main" java....
Senthuran Ambalavanar's user avatar
0 votes
0 answers
112 views

SQLcl Nashorn js missing on upgrade?

Recently upgraded to SQL Developer 21.4.3.063.0100 on Java 1.8.0_311 from 18.1.0.095.1630 on Java 1.8.0_152 And now all scripts running through the sqlcl component fail on startup Picked up ...
Skytunnel's user avatar
  • 1,083
1 vote
0 answers
49 views

Exception in thread "main" java.lang.NullPointerException: Cannot invoke "javax.script.ScriptEngine.eval(String)" because "<local2>" is null [duplicate]

Here's my full code: import javax.script.*; public class TestF { public static void main(String[] args) throws Exception { // create a script engine manager ScriptEngineManager ...
DavidNyan10's user avatar
1 vote
0 answers
178 views

Graalvm js interprets java.util.Date in different way than it did by nashorn js

We have migrated from jdk8 to jdk17, and had to use graalvm js instead of nashorn js. We found, that graalvm js interprets java.util.Date as long not as a Date. Here are 2 examples. Using jdk8 (...
EasyRider's user avatar
  • 149
0 votes
0 answers
130 views

Java 15, Nashorn 15.3: Can't access to java object public methods or properties

This is my example: package mypkg; import javax.script.*; public class Main { public static void main(String[] args) throws Exception { System.out.println("Start"); Main app = new ...
DmitriyD's user avatar
0 votes
1 answer
487 views

Nashorn in Java 8 maven project

I am facing a problem where the nashorn JavaScript engine does not work in my maven project. The following code works in a standalone java file when I use both java 8 and java 11, ScriptEngineManager ...
Pranav Bhandari's user avatar
1 vote
0 answers
592 views

Getting java.lang.NoClassDefFoundError: jdk/dynalink/RelinkableCallSite with org.openjdk.nashorn but only on linux with java 17

Just moving to Java 17 from Java 15 and this means the nashorn javascript module is no longer part of Java so I have moved to using https://github.com/openjdk/nashorn instead Modified code to directly ...
Paul Taylor's user avatar
  • 13.4k
0 votes
1 answer
73 views

Retrieve duplicated element using Jetty XML Parser

I'm currently using Jetty XML Parser in JavaScript Nashorn to retrieve certain nodes in an XML payload and I want to retrieve a certain child node with the same name. For example: <MessageV1 xmlns=&...
William Pham's user avatar
0 votes
1 answer
198 views

Javascript Validation in Java 15+ JUnit Test [duplicate]

Now that Nashorn has been deprecated & removed in JDK 15 what is the best approach to validate that a String is valid Javascript in a JUnit test? Previous Code: private void validateJavascript(...
Patrick Bray's user avatar
4 votes
2 answers
2k views

Cassandra: Unable to create javax script engine for javascript

I am trying to build apache cassandra project, following(this). I have jdk 11 on my mac machine. When I run 'ant' command, I get error: % ant Buildfile: ..../cassandra/build.xml Java 15 has removed ...
Mandroid's user avatar
  • 6,426
0 votes
1 answer
260 views

Verify if GraalVM is used

due to Nashorn being discontinued we are currently trying to change our (still Java 8) application (very big monolith) from Nashorn to GraalVM. Due to the application being used as library in multiple ...
XleKle's user avatar
  • 73
3 votes
2 answers
2k views

Apache Ant with Graal VM

We use Apache Ant with Nashorn JavaScript Engine, which became deprecated and removed in jdk 15 and up. I trying find how to switch from Nashorn to Graal VM and didn't find any usable information even ...
Ostap Bender's user avatar
0 votes
1 answer
639 views

Graalvm and Netbeans 12.5 to replace Nashorn functionality under Ant

I have some legacy java & fx code that built perfectly in older versions of Java and Netbeans (using ANT). I recently revisited this to upgrade the ide and jdk/jre for java and fx. Of course, it ...
user4351718's user avatar
0 votes
1 answer
1k views

JS script doesn't run with Java 11 but works with Java 8

I have a JS script that works fine when run using JDK 8, but fails with the error on Java 11. The error is: unknown call type GET:PROPERTY|ELEMENT|METHOD:NODE_PATH(Object)[email protected]....
yu.pitomets's user avatar
  • 1,730
2 votes
0 answers
415 views

GraalVM / Nashorn compatibility for Java enum

I'm playing with GraalVM (v21.2.0), trying to assess backward compatibility with Nashorn. Many things work pretty well including Java Map, Collection, Beans handling. But I have the following problem ...
Sébastien Bouat's user avatar
1 vote
1 answer
1k views

compilation error of jdk nashron when updated from jdk1.8 to jdk 11

Updated with more details : My objective is to set source of below code .

source(sourceSets.map { it.javaDirectories }.flatten()) 

above code working fine with jdk 1.8 but when I changed to jdk ...
jitendra kumar's user avatar
2 votes
2 answers
5k views

JDK version updated, now Karate tests cannot be found [duplicate]

Today our IT department initialized an automatic uninstall of Java JDK 14 due to some security concern. I downloaded the latest, JDK 16, and updated all of my project settings using this as a guide: ...
Allison Crenshaw's user avatar
0 votes
1 answer
284 views

How to convert ScriptEngine.eval to Java object

I'm using ScriptEngine to run a Javascript. In my case, the Javascript will always return a boolean. I thought that eval() would return an Object that I can cast, but instead it seems to return a ...
Peter Kronenberg's user avatar
2 votes
1 answer
436 views

Support/Alternative of Nashorn with Spring Native

In my company we use Nashorn in Java 11 and spring-boot which is working fine, but we recently decided to use spring-native with docker. We ended up to make the image build, but at startup, the ...
Nicolas B's user avatar
3 votes
1 answer
3k views

Aggregate attributes of roles in claims using Keycloak Script Mapper

We have a Keycloak Script Mapper to add attributes of roles to the ID token. The goal is to aggregate the values available in attributes for the roles. The mapper looks like this: /** * Merge with ...
user2609980's user avatar
  • 10.3k
1 vote
1 answer
230 views

Addition operation in Nashorn javascript engine -java8

I have 2 variables to add using engine.eval()- nashorn javascript engine in java8.? I've used code like this: ScriptEngineManager sem=new ScriptEngineManager(); ScriptEngine engine = sem....
Antony Jacob's user avatar
8 votes
2 answers
10k views

Does Nashorn (org.openjdk.nashorn) have any support for Java 17?

I am trying to run an ANT build of our product using nashorn-core:15.1.1.jar with Java 17 (pre-release - build 27) and I get: BUILD FAILED java.lang.ExceptionInInitializerError at org.openjdk....
gjwatts's user avatar
  • 123
0 votes
1 answer
114 views

Regex lookbehind/lookahead in Nashorn

Here is what i want to do: I want to replace certain tokens in a string, but only if they are not inside another word. Example: token= pos replacement= XXX //Strings to check: Repository pos ...
Aeglasin's user avatar
  • 165
-1 votes
1 answer
3k views

Nashorn JavaScript engine removed from Java 16 - Is there any replacement? [closed]

Nashorn JavaScript engine removed from Java 16. I am running Java application (Minecraft server) which using plugin which using Nashorn Engine to run JavaScript snippets. I recently updated my server ...
Baterka's user avatar
  • 3,195
0 votes
1 answer
54 views

TypeError when trying to set a property of a Struct (Nashorn, Kafka Connect transformer)

Using Kafka Connect (6.1.1), I'm trying to use Sergey34/kafka-connect-transformers to adjust my Kafka messages before putting them into BigQuery (using BigQuerySink). In my connector.properties, I ...
Tobias Hermann's user avatar
0 votes
1 answer
1k views

In the Nashorn JavaScript engine, how can I read a file from the file system?

In the Nashorn JavaScript engine, how can I read a file from the file system? In node.js I use fs = require('fs'); var content = fs.readFileSync("sometext.txt") but in Nashorn this gives ...
halloleo's user avatar
  • 9,412

1
2 3 4 5
15