How to navigate to a working directory in ProcessBuilder

186 Views Asked by At

I am trying use Process builder and execute a cleartool command from a drive setup for clearcase. Below is my code and it seems to return null. Can any one please suggest how to fix this issue.

String[] cmdList = {"cmd.exe","/C","M:", "cd Test_SrcCd_Dev_Dyn","cleartool lsactivity -l TestActivity@My_PVOB"};
ProcessBuilder builder = new ProcessBuilder(cmdList);

My clearcase repository is configured in M: drive.

Thanks in advance.

1

There are 1 best solutions below

2
On

Try to simplify the sequence of command to make sure you are in the right directory.

But first:

cleartool lsactivity -l TestActivity@My_PVOB

This should work from any directory (except you need to be in the view to resolve the extended pathnames of the file)

Can you first confirm that this works?

String[] cmdList = {"cmd.exe","/C", "cleartool lsactivity -l TestActivity@My_PVOB"};

You can also replace in your original command your cleartool lsact by a:

cleartool pwv

To check you are in the right directory/view.

Try also to display the path, to check that 'cleartool.exe' is in it.