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

145
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 projects, instead of using the whole GraalVM runtime we decided to just adding the necessary jars to the class path (which seem to work so far).

To use GraalVM, I changed all occurrences of getEngineByName to graal.js as follow:

ScriptEngineManager sem = new ScriptEngineManager(null);
scriptEngine = sem.getEngineByName("graal.js");

Due to the application being very complex, understanding every aspect of the application is relatively difficult and I was wondering if there is a way of verifying what JavaScript engine is used with the prepared JavaScript string as input? My goal is to write a Unit test which verifies for every method which takes JavaScript as input, if GraalVM is really used.

What would be the best approach to achieve this?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

you can compare the class name of the script engine with com.oracle.truffle.js.scriptengine.GraalJSScriptEngine something like this:

ScriptEngine  scriptEngine = new ScriptEngineManager().getEngineByName("graal.js");
            String engineName = scriptEngine.getClass().getName();
            boolean isGraalJS = engineName.equals("com.oracle.truffle.js.scriptengine.GraalJSScriptEngine");
            System.out.println(isGraalJS);
about 4 years ago · Juan Pablo Isaza Report
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!