Here is ex how to call new instance of java obj, but how to import mylib.jar is not explained
For ex. I have mylib.jar and there is class com.example.MyClass.
public class MyClass{
public String getHelloPersonName(String name){
return "Hello, " + name;
}
I want to create the java class instance and call this method
How to import the .jar file to the lua code, and create an instance of MyClass and call method from it?
function init()
end
java -jar mylib.jarwith arguments?mylib.jaris not explainedprogram.luaassuming your lib is already loaded in Java. Then runjava -cp "lib/luaj-jse-3.0.1.jar;/path/to/mylib.jar" lua program.lualuajava.newInstance(). Try it inside yourprogram.lua. Read LuaJ API about other operations (passing and returning values and so on).