# How can I execute a Java application that asks for user input?

**URL:** <https://discuss.gradle.org/t/how-can-i-execute-a-java-application-that-asks-for-user-input/3264>\
**Category:** Old Forum Archive\
**Created:** [February 21, 2012, 10:08pm UTC](https://discuss.gradle.org/t/how-can-i-execute-a-java-application-that-asks-for-user-input/3264 "2012-02-21T22:08:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ghillert](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/ghillert/32/669_2.png) [@ghillert](https://discuss.gradle.org/u/ghillert)\
**Post date:** [February 21, 2012, 10:08pm UTC](https://discuss.gradle.org/t/how-can-i-execute-a-java-application-that-asks-for-user-input/3264/1 "2012-02-21T22:08:00Z")

</div>

Hi,

How can I execute a Java application that asks for user input?

This should be fairly straightforward:

apply plugin: ‘application’

mainClassName = “a.b.c.Main”

$ gradle run

The application does start up successfully BUT it looks like any calls to inputstream.readLine(); are ignored. Is this related to:

GRADLE-1483?

Is there are work-around possible with M8?

Thanks!

Cheers,

Gunnar

---

<div class="post-metadata">

**Author:** ![Rene](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/rene/32/8082_2.png) [@Rene](https://discuss.gradle.org/u/Rene)\
**Post date:** [February 21, 2012, 10:30pm UTC](https://discuss.gradle.org/t/how-can-i-execute-a-java-application-that-asks-for-user-input/3264/2 "2012-02-21T22:30:00Z")

</div>

Hello Gunnar, the run task of the application plugin is of type JavaExec. As you can see in the DSL reference for the JavaExec ( [http://gradle.org/docs/current/dsl/org.gradle.api.tasks.JavaExec.html](http://gradle.org/docs/current/dsl/org.gradle.api.tasks.JavaExec.html) ) the default input stream is set to empty. To change this behavior you can add the following to your build script:

```gradle
run{
 standardInput = System.in
}

```

regards, René
