Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I am using Java script engine to run javascript at run time and I have a java method like so

public void func(Object x, Object... args)
{//CODE..}

And I am trying to call that method via the script engine

classX myClass = new classX();
scriptEngine.bind("myClass", myClass);

scriptEngine.eval("myClass.func(1, 2,3,4,5)");

But the method wont run. all I get is null, no error.

share|improve this question
add comment

1 Answer

try using put instead of bind...its work for me scriptEngine.put("myClass", myClass);

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.