Hi everyone,
I wrote the below small code to run one command line argument in my program but somehow couldnt understand how to store or retrieve the output generated by that command line.So i would be very thankful if someone helps me with this.

Runtime rt = Runtime.getRuntime();
Process pr = rt.exec("dbentry -i 1234 -U loclucmed09");

Regards,
aru211285

Recommended Answers

All 3 Replies

Thanks for teh reply. But here i found that read can give me only an integer but the output what im expecting is a string(text of 4-5 lines). When i tried using converting integer to string its giving me some number but not the output string.

I said read it, not, literally, use the read method. See the API docs for InputStream, and read that article I posted, and more things will come clear to you. There are a plethora of code examples in that article, as well.

And that "int" is a byte value. Once again, read the API docs and that article.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.