Waldemar Lima Well-Known Member Licensed User Longtime User Jul 19, 2018 #1 hi everyone ! i am using LuaJ .jar in my application . how can i convert this > Code: Copy import org.luaj.vm2.*; import org.luaj.vm2.lib.jse.*; Globals globals = JsePlatform.standardGlobals(); LuaValue chunk = globals.load("print 'hello, world'"); chunk.call(); to B4J using JavaObject ? i had used > Code: Copy jo.InitializeStatic("org.luaj.vm2.*") jo.InitializeStatic("org.luaj.vm2.lib.jse.*") but i get this error > java.lang.ClassNotFoundException: org$luaj$vm2 Click to expand...
hi everyone ! i am using LuaJ .jar in my application . how can i convert this > Code: Copy import org.luaj.vm2.*; import org.luaj.vm2.lib.jse.*; Globals globals = JsePlatform.standardGlobals(); LuaValue chunk = globals.load("print 'hello, world'"); chunk.call(); to B4J using JavaObject ? i had used > Code: Copy jo.InitializeStatic("org.luaj.vm2.*") jo.InitializeStatic("org.luaj.vm2.lib.jse.*") but i get this error > java.lang.ClassNotFoundException: org$luaj$vm2 Click to expand...
Daestrum Expert Licensed User Longtime User Jul 20, 2018 #2 To use javaobject how you want, you will need to know the class names within org.luaj.vm2 and org.luaj.vm2.lib.jse. You are trying to assign a package name with a wild card to a javaobject, this will not work as you have to assign a class to the javaobject. The first line of your code above code would translate to something like : Code: Copy ... Dim jsePlatform As JavaObject Dim globals As JavaObject … jsePlatform.InitializeNewInstance("org.luaj.vm2.lib.jse.JsePlatform",null) globals = jsePlatform.RunMethod("standardGlobals",null) … Upvote 0
To use javaobject how you want, you will need to know the class names within org.luaj.vm2 and org.luaj.vm2.lib.jse. You are trying to assign a package name with a wild card to a javaobject, this will not work as you have to assign a class to the javaobject. The first line of your code above code would translate to something like : Code: Copy ... Dim jsePlatform As JavaObject Dim globals As JavaObject … jsePlatform.InitializeNewInstance("org.luaj.vm2.lib.jse.JsePlatform",null) globals = jsePlatform.RunMethod("standardGlobals",null) …
Harris Expert Licensed User Longtime User Jul 20, 2018 #3 Daestrum said: To use javaobject how you want, you will need to know the class names Click to expand... That begs the question: how can one find the class names (and params) other than begging the author for some full documentation on it's use (which is often hard to obtain). De-compile the jar perhaps? Try and figure it out from there? I have often wondered how - when using JavaObject - what to call, params and other requirements... Samples provided (by Erel and others) give specific based on question... Where in the heck did they get that knowledge? They make it seem so simple... Thanks Upvote 0
Daestrum said: To use javaobject how you want, you will need to know the class names Click to expand... That begs the question: how can one find the class names (and params) other than begging the author for some full documentation on it's use (which is often hard to obtain). De-compile the jar perhaps? Try and figure it out from there? I have often wondered how - when using JavaObject - what to call, params and other requirements... Samples provided (by Erel and others) give specific based on question... Where in the heck did they get that knowledge? They make it seem so simple... Thanks
Daestrum Expert Licensed User Longtime User Jul 20, 2018 #4 In the case above I simply googled "org.luaj.vm2 api" which returned the Javadoc for the package. This showed the classes within each of the package names. The class Javadoc shows the methods , their return types and required parameters. Upvote 0
In the case above I simply googled "org.luaj.vm2 api" which returned the Javadoc for the package. This showed the classes within each of the package names. The class Javadoc shows the methods , their return types and required parameters.