Getting error "javax.script.ScriptException: ReferenceError: "$" is not defined in <eval> at line number 3" when calling js function with nashorn

Viewed 21

When calling javaScript function from Java program using Nashorn, I am getting the error below:

"javax.script.ScriptException: ReferenceError: "$" is not defined in at line number 3"

I think what is missing is Nashorn couldn't find Jquery Libraries where the reference of $ is defined. So I would like to know please how can I load Jquery libraries in Nashorn.

The part of the js code containing a "$" is:

$(".bootstrap-growl").remove();

And I know that "bootstrapGrowl" is defined on the library "https://cdnjs.cloudflare.com/ajax/libs/bootstrap-growl/1.0.0/jquery.bootstrap-growl.min.js" but I don't how to load it, how to make Nashorn/eval read it.

Thanks for your help.

0 Answers
Related