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

155
Views
How would I get properties from a javascript object defined in java using GraalJS

I would like to make a java object binding that needs to take in javascript properties. This is the java code I have,


public String name;
public int version;

public void load() {
     Context context = Context.newBuilder().allowExperimentalOptions(true).option("js.nashorn-compat", "true").option("engine.WarnInterpreterOnly", "false").allowHostAccess(HostAccess.ALL).build();

     context.getBindings("js").putMember("setup", this);

     context.eval(Source.newBuilder("js", scriptFile).build());
}

I want to be able to set the name and version variable when the object is defined in javascript using properties like so

var script = setup({
     name: "Test",
     version: 1
});

How would I be able to get the properties and use them to set these variables? I know in javascript you can do this by putting @property {number} but I don't know how I would do something like that in java.

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!