How to integrate Java and Python?
<p>I am trying something out combining java and python for some encryption reasons where the encryption code is actually a java file from the provider but I am writing a python code. So what I want is to execute the encryption code on java using </p>

<pre><code>x = os.system("java file.java")
</code></pre>

<p>and just return the value from the java execution like in a function</p>

<pre><code>print x
</code></pre>

<p>Like this:</p>

<p><strong>java_hello_world.py</strong></p>

<pre><code>import os

x = os.system("java HelloWorld")
print x # This should print HELLO WORLD
</code></pre>

<p><strong>HelloWorld.java</strong></p>

<pre><code>public class HelloWorld {
    public static void main(String[] args) {
        String x;
        x = "Hello World";
        System.out.println(x);
        return "HELLO WORLD";
    }

}
</code></pre>

<p>The java file above by the way returns an error:</p>

<pre><code>HelloWorld.java:7: error: incompatible types: unexpected return value
return x;
</code></pre>

<p><strong>PS</strong></p>

<p>I am not a Java Developer, I have zero experience</p>

<p>Any suggested method will be great as long as I have my desired result in python</p>