Im trying to compile some java files using the Runtime.getRuntime.exec(command) and im generating the command. The code below shows what i am doing:
String command = "javac ";
for(String s: this.getPackages())
{
command = command + "/home/benuni/CompileFiles/" + project + "/" + s + "/*.java ";
}
try {
System.out.println("command: '"+ command +"'");
Process pro = Runtime.getRuntime().exec(command);
printLines(" stderr:", pro.getErrorStream());
pro.waitFor();
This is giving the following output:
command: 'javac /home/benuni/CompileFiles/HelloWorldProject/HelloWorldPackage/*.java '
stderr: javac: file not found: /home/benuni/CompileFiles/HelloWorldProject/HelloWorldPackage/*.java
stderr: Usage: javac <options> <source files>
stderr: use -help for a list of possible options
and its not working.. but if i copy the command into my shell, it works no problem... any ideas?