0

I am trying to download zip file from svn using java but nothing worked out. Through command prompt it is getting downloaded so i thought of executing command prompt through java. My java code is:

import java.io.BufferedReader;
import java.io.IOException;

import java.io.InputStreamReader;

public class aaa {

public static void main(String[] args) throws IOException, InterruptedException {

    String command = "svn co --username username --password pass http://interactive/svn/Test_Mariza/trunk/test/seatapps.zip /home/vaishali/aaa/";

    Process proc = Runtime.getRuntime().exec(command);

    // Read the output

    BufferedReader reader =  
          new BufferedReader(new InputStreamReader(proc.getInputStream()));

    String line = "";
    while((line = reader.readLine()) != null) {
        System.out.print(line + "\n");
    }

    proc.waitFor();   

}
} 

The command which i am passing as an argument is executing through terminal but not getting executed through java code. Can anyone help me out.

npinti
  • 51,780
  • 5
  • 72
  • 96
Dimple
  • 111
  • 2
  • 11

1 Answers1

-2

To execute a command in Java:

Runtime.getRuntime().exec(" Insert command here ");

For references: How do I run a batch file from my Java Application?

Community
  • 1
  • 1
Dopdop
  • 37
  • 3