you cannot call javascript from java. javascript is a client language and runs in a browser where java runs on the server
Update: Thank you guys, I learned something new here.
when i execute the code in op i appears below error
Error executing script: ReferenceError: "alert" is not defined in <eval> at line number 1
The reason is the warning is not part of JavaScript, it is part of the window object provided by web browsers. In addition, the Javascript Nashhorn mechanism is not aware of this.
See ReferenceError: "alert" not defined
M sach
source share