import java.io.*;
public class chk 
{
String className;
String command,command1,command2;
public String  getMsg(String fileName,String Path) 
{
    String dir;
    command1="cd "+Path;
    dir=Path.charAt(0)+Path.charAt(1)+"";
    command2=dir;
command = "javac " + fileName;
    String a=executeCommand(command1);
    a=executeCommand(command2);
String output = executeCommand(command);
if(output.compareTo("")==0)             
        output = "Compilation Successfull!!";
    return output;
}
private String executeCommand(String command) 
{
    StringBuffer output = new StringBuffer();
    Process p;
    try 
    {
        p = Runtime.getRuntime().exec(command);
        p.waitFor();
        BufferedReader reader1 = new BufferedReader(new InputStreamReader(p.getErrorStream()));
        BufferedReader reader2 = new BufferedReader(new InputStreamReader(p.getInputStream()));
        String line = "";           
        while ((line = reader1.readLine())!= null) 
        {
            output.append(line + "\n");
        }
        while ((line = reader2.readLine())!= null) 
        {
            output.append(line + "\n");
        }
    } catch (Exception e) 
    {
        e.printStackTrace();
    }
    return output.toString();
}
public static void main(String args[])throws IOException
{
        String x;
    chk ob=new chk();
    x=ob.getMsg("MyClass.java","D:\test");
    System.out.println("OUtput : "+x);
}
}
Error

I am trying to run a bunch of commands in command prompt with the help of a java file so that later i can compile another java file named "MyClass.java" which is present at some other drive in my computer but i am getting the following error stating it cannot even execute my first command i.e "command1="cd "+Path;" this line . pls help!