KubeJS

KubeJS

69M Downloads

Import java class, dev.latvian.mods.rhino.NativeJavaClass cannot be cast to dev.latvian.mods.rhino.NativeJavaPackage

Tankonyako opened this issue ยท 10 comments

commented

Error log: https://pastebin.com/rV1At2rg

Crashing when using Packages or import direclty.
image

How i can use java class in js?

commented

I think the class has to be defined on its own, then you can use members

var JMath = java.lang.Math
console.info(JMath.PI)
commented

I think the class has to be defined on its own, then you can use members

var JMath = java.lang.Math
console.info(JMath.PI)

This is not working, same error, im tried too much examples from Rhino. This is bug without KubeJs.
Examples from here not working, and cause same error:
https://devopspoints.com/javascript-scripting-java-with-rhino.html
https://github.com/mozilla/rhino/blob/master/examples/NervousText.js

commented

I think you can add method for class define to utils or make like API like in Nashorn Java.type("class"), or fix this issue with Rhino.

commented

I assume you're using latest version of KubeJS 1.16, because this was only added recently

commented

I assume you're using latest version of KubeJS 1.16, because this was only added recently

yes.
in kubejs-1605.3.6-build.170 also not working.
I need another version of Rihno engine mod?

commented

Hello, any fixes?

commented

image

Removing class shutter "fixes" it but its probably something simple

commented

Ok, I get that error too now. Weird, that didn't happen before. I'll look into it

commented

Found the issue, need to figure out how to fix. its something to do with Context#setClassShutter, it seems to block too much

commented

I couldn't reproduce the same issue in dev, but maybe the newest build has changed something