-4

For ex:- C:\Users\nayasano> is the default and I want to change that to C:\Program Files\Hewlett-Packard\CDA\1.30\bin, It the directory I want to change to this. By using Java code and after that I run some command form my java code.

Please give some solution for this

TMH
  • 23
  • 1
  • 3
  • http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/ProcessBuilder.html#directory%28java.io.File%29 ? – JimmyB Jul 09 '14 at 11:49
  • 1
    possible duplicate of [Changing the current working directory in Java?](http://stackoverflow.com/questions/840190/changing-the-current-working-directory-in-java) – Raedwald Jul 09 '14 at 11:49
  • possible duplicate of http://stackoverflow.com/questions/994273/how-to-change-command-prompt-console-window-title-from-command-line-java-app – Raedwald Jul 09 '14 at 11:50

1 Answers1

0

you can not change the directory, instead of this you can run your programs by the following code in java class :-

try{
    Runtime.getRuntime().exec("C:\Program Files\Hewlett-Packard\CDA\1.30\bin\run.bat");
   }
   catch(Exception ex)
    {

    }
Vishal
  • 141
  • 9