Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Calling SCM via Java

Hey folks,
I'm writing a Java application to call the RTC scm command line client to login, create workspaces, and load data.

I'm using the Java Process and ProcessBuilder classes for this.

The issue I'm running into, is that I'm losing the error messages.  Process getInputStream(), along with a call to ProcessBuilder.redirectErrorStream(true).

When I call "scm create workspace -r <ourjazzuri> "workspacename", there's a problem, and I get "problem running 'create workspace':, but no information is added.

The returnCode from running that command is 25.  Anyone know why I'm not getting the info?

Thanks a million,
Chris

0 votes



One answer

Permanent link
I found this page, so I now know what error code 25 means, but I'm still unsure how to get the appropriate error messages via Java.

http://stackoverflow.com/questions/14165517/processbuilder-forwarding-stdout-and-stderr-of-started-processes-without-blocki

1 vote

Comments

the typical protocol for commandline applications is to generate good data on stdout (handle 1) and error info on stderr (handle 2)...


so if you are launching the app i java, you would need to capture the stderr output as well. 

1 vote

t turns out that I was not getting the output in the correct order. i.e. I was calling process.waitFor() before reading my stream.

Fixed now.  Thanks!!!

that will do it!.. thanks for posting back 

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 1,202
× 113
× 13

Question asked: Feb 26 '14, 11:19 a.m.

Question was seen: 6,498 times

Last updated: Apr 17 '14, 4:41 a.m.

Confirmation Cancel Confirm