Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

194
Views
Nashorn - Java8 - declare Window & typeof globalThis

I want to invoke JavaScript code into my Java code, I tried to use Nashorn. When I try to run my I code I got an error that window is not recognized (ReferenceError: "window" is not defined in at line number 1)

ScriptEngineManager engineManager = new ScriptEngineManager();
    ScriptEngine engine = engineManager.getEngineByName("nashorn");
    String script = "if(window.ServicesXXXX== null) {\n"
        + "            window.ServicesXXXX.stopInv();}";

    try {
          engine.eval(script);
    } catch (ScriptException e) {
        LOGGER.info("Error in the invoque of js", e.getMessage());
    }

My question is how to declare var window: Window & typeof globalThis ?

Thank you

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!