I have a question about using os.execvp
in Python. I have the following bit of code that's used to create a list of arguments:
args = [ "java" , classpath , "-Djava.library.path=" + lib_path() , ea , "-Xmx1000m" , "-server" , "code_swarm" , params ]
When I output a string using " ".join(args)
and paste that into my shell prompt, the JVM launches fine, and everything works. Everything works if I use os.system(" ".join(args))
in my Python script, too.
But the following bit of code does not work:
os.execvp("java", args)I get the following error:
Unrecognized option: -classpath [and then the classpath I created, which looks okay] Could not create the Java virtual machine.
So what gives? Why does copying/pasting into the shell or using os.system()
work, but not os.execvp()
?