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
x = os.system("java file.java")
and just return the value from the java execution like in a function
print x
Like this:
java_hello_world.py
import os
x = os.system("java HelloWorld")
print x # This should print HELLO WORLD
HelloWorld.java
public class HelloWorld {
public static void main(String[] args) {
String x;
x = "Hello World";
System.out.println(x);
return "HELLO WORLD";
}
}
The java file above by the way returns an error:
HelloWorld.java:7: error: incompatible types: unexpected return value
return x;
PS
I am not a Java Developer, I have zero experience
Any suggested method will be great as long as I have my desired result in python