First use of jep

38 views
Skip to first unread message

Aghiles Djelouahi

unread,
May 18, 2022, 9:05:42 AM5/18/22
to Jep Project
Hello, 

I'm trying to use jep to launch python functions/instructions in my java code.

I have installed jep on Ubuntu as shown on the github page.

When I try to launch the program below on the Intellinj ide, I get nothing except this message "Process finished with exit code 0".

Here is the code I run :

    public static void main(String[] args) throws JepException {
        StringBuilder script = new StringBuilder();
        script.append("a = 'Passed'\n");
        script.append("b = 'Failed'\n");
        script.append("result = max(a,b)");
        try (Interpreter interp = new SharedInterpreter()) {
            interp.exec(script.toString());
            interp.exec("print('toto')");
            String result = interp.getValue("result", String.class);
            if (!"Passed".equals(result)) {
                throw new IllegalStateException(
                        "multi-line exec returned " + result);
            }
        }
    }


For information, I am using Java 1.8 and Python 3.6.

Can you help me solve this problem? 

Akash Wadagire

unread,
Sep 11, 2023, 8:21:53 AM9/11/23
to Jep Project
Hi Good Evening 
I am Akash , I am trying to call the python from the Java (in the Spring boot ) can you guide me how to set up the JEP in the Spring boot or please share  me the link or notes .
thank you 
Reply all
Reply to author
Forward
0 new messages