Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

recieve output from java python

import os.path,subprocess
from subprocess import STDOUT,PIPE

def compile_java(java_file):
    subprocess.check_call(['javac', java_file])

def execute_java(java_file, stdin):
    java_class,ext = os.path.splitext(java_file)
    cmd = ['java', java_class]
    proc = subprocess.Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=STDOUT)
    stdout,stderr = proc.communicate(stdin)
    return stdout

compile_java('helloworld.java')
java_output = execute_java('helloworld.java', 'args')
Comment

PREVIOUS NEXT
Code Example
Python :: cumulative some by date for each user 
Python :: list lambda functions boto3 
Python :: files and exceptions not working python 
Python :: call a function with prameters inm tkinter buttion 
Python :: break line text opencv 
Python :: py regex if .jpg 
Python :: callbacks to function pysimplegui 
Python :: python type hint superclass 
Python :: python diccionario setdefault 
Python :: can we use python functions in node 
Python :: how to map data to a scale python 
Python :: open anarchy ip 
Python :: pandas average of vectors after groupby 
Python :: print without parenthesis 
Python :: python thunks 
Python :: Python Multiline docstring example 
Python :: x = y < z and z y or y z and z < y python 
Python :: Python String to array using list() method 
Python :: List Change Sublist 
Python :: Tableau prep encoding to a set of fields in a flow 
Python :: python print x y coordinates 
Python :: php echo shorthand example 
Python :: printing multiple input in python 
Python :: turtule code for digital clock 
Python :: check for the negative integers and float 
Python :: python check column conditions 
Python :: df.loc 
Python :: jinja 2 iterate over dictionary 
Python :: the command 
Python :: get the value of qpushbutton pyqt5 with argument 
ADD CONTENT
Topic
Content
Source link
Name
4+8 =