While trying to embed python code into java wrapper getting no module found error for llama_index

72 Views Asked by At

I am trying to embed python code into java wrapper for this i am using jython library .In python script i have libraries like llamaindex and langchain while executing script with java getting error llama_index module not found. Is there a way to add external libraries into jython.

I tried below script but it getting error with resource warning

public class Main {
    public static void main(String[] args) {
        Properties properties = System.getProperties();
        properties.put("python.path" , "path of library");
        PythonInterpreter.initialize(System.getProperties() , properties , new String[0]);
        PythonInterpreter pythonInterpreter = new PythonInterpreter();
        pythonInterpreter.execfile("pythonscript.py");
    }
}
0

There are 0 best solutions below