I'm trying to run a java class from a python script with subprocess.call():
import os
import subprocess
java_file = os.getcwd() + "/src/ch/idsia/scenarios/Main.java"
if os.path.isfile(java_file):
java_class, _ = os.path.splitext(java_file)
cmd = ['java', java_class]
subprocess.call(cmd, shell=False)
But running this python script gives me Error: Could not find or load main class .Users.alavin.Code.MarioAI_ver02_April_2011.src.ch.idsia.scenarios.Main. I've also tried the following variations for java_class:
"Users.alavin.Code.MarioAI_ver02_April_2011.src.ch.idsia.scenarios.Main"
"src.ch.idsia.scenarios.Main"
The python script is located in "Users/alavin/Code/MarioAI_ver02_April_2011/". The java class is "Main.java" in package "src.ch.idsia.scenarios". The java project is in Eclipse.
Notes: mac osx 10.9; python 2.7; java 1.7; using jython is not an option; running echo $CLASSPATH from the terminal gives a blank line.
Thank you in advance for any help/guidance.
Main.classis present in/Users/alavin/Code/MarioAI_ver02_April_2011/src/ch/idsia/scenarios/Main.classis in/Users/alavin/Code/MarioAI_ver02_April_2011/bin/ch/idsia/scenarios/. I.e. the.javafiles in the 'src/' directory have their corresponding.classfiles in thebin/directory. Is this a problem?