# command linux in java code

**URL:** <https://community.unix.com/t/command-linux-in-java-code/309278>\
**Category:** Programming\
**Created:** [April 28, 2012, 11:11am UTC](https://community.unix.com/t/command-linux-in-java-code/309278 "2012-04-28T11:11:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![chercheur857](https://community.unix.com/letter_avatar/chercheur857/32/6_449c533f586939b6e5f246632a46421f.png) [@chercheur857](https://community.unix.com/u/chercheur857)\
**Post date:** [April 28, 2012, 11:11am UTC](https://community.unix.com/t/command-linux-in-java-code/309278/1 "2012-04-28T11:11:40Z")

</div>

Hello

> [@](#):
>
> String cmd="touch {1..10}";  
> Process process = Runtime.getRuntime().exec(cmd);  
> process.waitFor();
> 
> ```
> InputStream is = process.getInputStream\(\);
> BufferedReader br = new BufferedReader\(new InputStreamReader\(is\)\);
> while\(true\) \{
> String line = br.readLine\(\);
> if\(line == null\) break;
> System.out.println\(line\);
> 
> \}
> 
> ```

Please why the files have not created?

Thank you
