Call java method from javascript

How to call java method from javascript in cocos 3.4
And jsb is not defined how to fix it

You can directly use jsb.

jsb.reflection.callStaticMethod("com/cocos/game/Test", "func", "(II)I", arg, arg);

you can refer to this:
https://docs.cocos.com/creator/3.4/manual/en/advanced-topics/java-reflection.html?h=java

Thanks for help…i already tried it but not working
…is there any way to import that
Its throw an error jsb is not defined

Is it a Typescript syntax error or a runtime error?

Its runtime error…
Is there any way to call method…?
Please tell me …i am so frustrated now

Is it running on the native platform? jsb is not available on the web platform

Yes its running on native platform

For me its working fine on Android, Creator 3.4.2

I am using 3.2

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.