2

I am trying to execute cleartool commands from batch script using Java ProcessBuilder but it is getting stuck at rebase command

[startview command is executed successfully (ERRORLEVEL = 0)]

When I try using Runtime.exec with command array [{"cleartool.exe","<startview command>"}], it says

cleartool Error: unrecognized command startview

Does anyone know how to fix it?

Tunaki
  • 132,869
  • 46
  • 340
  • 423
A K Malik
  • 31
  • 3

1 Answers1

0

Make sure the cleartool rebase does not involve any interactive step (where it would stop and listen for input on stdin).

Make sure your CMD has, by default, in its %PATH% environment variable a path to cleartool.exe.
Then follow this answer:

String commandToBeExecuted="cleartool xxx"
Process p = Runtime.getRuntime().exec(new String[]{"cmd", "/c", commandToBeExecuted);

Since cmd.exe is blocked ("cmd is disabled"), the OP A K Malik confirms that not using an array works:

Process p = Runtime.getRuntime().exec("<rebase command>") 
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250