0
13738
We have a Java program as follows in the name A.java
class A {
public static void main(String args[]){
System.out.println("I am in Java Program");
}
}
Compile and run java program
$ javac A.java
$ java A
I am in Java Program
Like we run the above code from the console and getting the output , the same java code can be run inside the Python code as follows
output = subprocess.check_output("java A", stderr=subprocess.PIPE)
print(output)
I am in Java Program
Comment here