I am having trouble using lua's posix.execp() function to execute a java program within a child process. I want to be able to create pipes and have the processes communicate with each other. Hence why I want to use luaposix .For some reason it interprets all forward slashes as periods in the classpath. I am not entirely sure if I am setting this up right. I am wondering if I am doing something wrong in the table that I am giving to the execp() function.
argjava={}
argjava[0]="java"
argjava[1]="-cp"
argjava[2]="/home/joeA/tree-lstm/lib/:'
argjava[3]="/home/joeA/tree-lstm/lib/stanford-parser/stanford-parser.jar:"
argjava[4]="/home/joeA/tree-lstm/lib/stanford-parser/stanford-parser-3.5.1-models.jar"
argjava[5]="ConstituencyParser"
argjava[6]="-tokenpath"
argjava[7]="tokens.tmp"
argjava[8]="-parentpath"
argjava[9]="parents.tmp"
argjava[10]=nil
posix.execp("java",argjava)
I want it to make it look like this:
java -cp /home/joeA/tree-lstm/lib/:/home/joeA/tree-lstm/lib/stanford-parser/stanford-parser.jar:/home/joeA/tree-lstm/lib/stanford-parser/stanford-parser-3.5.1-models.jar ConstituencyParse -tokpath tokens.tmp -parentpath parents.tmp
This is an error that comes up:
Error: Could not find or load main class .home.joeA.tree-lstm.lib.stanford-parser.stanford-parser.jar:
argjavabecomes an independent argument tojavaon the command line. So you can't split up the parts of the argument to-cplike that. Try putting the paths and jars in a single string/value.