Im trying to load the json module in Java code. The example in the Doc shows that it should go like this but it doesnt work. Does it require the module to be in the project or it loads it from LUA_PATH. does anyone have any experience with this issue?

Globals globals = JsePlatform.standardGlobals();
globals.get("require").call( LuaValue.valueOf("json") );

Exception in thread "main" org.luaj.vm2.LuaError: module 'json' not found: json no field package.preload['json'] json.lua no class 'json'

It looks like it is trying just within the LuaJ package.

没有正确的解决方案

其他提示

If the json module you are using is written in lua, then it'll need to be in the package.path like any other lua module.

If it's written in java then LuaJ will need to be able to find json.class in the normal Java classpath.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top