looking for some solutions? You are welcome.

SOLVED: Java Spring Boot failing to find Python Script in resources folder


I am trying to call python Scripts(in resources) from my Java class. This is my code spinnet

        String res = "/Scripts/Brokers/__init__.py";

        URL pathUrl = this.getClass().getResource(res);
        String path = "";
        if(pathUrl != null)
            path = pathUrl.toString();

        ProcessBuilder pb = new ProcessBuilder("/usr/bin/python3.6", path);

ProcessBuilder is giving error No such file or directory.


value of path = "file:/home/path-to-project/project-name/out/production/resources/Scripts/Brokers/\__init__.py"

Also how to include python scripts in jar file to run the project on linux server.

I am stuck with this issue since last 3 days. Please suggest.

Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots

No comments: