title: Same Java code Failed to run under Java Gradle Application
body: <p>I have come across an issue when running the following code under Netbeans Gradle Java Application.</p>
  <pre><code>import java.util.Scanner;
  import java.util.concurrent.TimeUnit;
  
  public class Main {
      private static int imgBundle;
      private static int flacBundle;
      private static int vidBundle;
      public static void main(String[] args) {
          takeInput();
      }
      private static void takeInput() {
          Scanner input = new Scanner(System.in);
          System.out.print(&quot;Please enter the number of Image format for the order: &quot;);
          imgBundle = input.nextInt();     // where the error occurred
          System.out.print(&quot;Please enter the number of Audio format for the order: &quot;);
          flacBundle = input.nextInt();    // where the error occurred
          System.out.print(&quot;Please enter the number of Video format for the order: &quot;);
          vidBundle = input.nextInt();     // where the error occurred
          System.out.println(&quot;Your Order Input:&quot;);
          System.out.println(imgBundle + &quot; IMG&quot;);
          System.out.println(flacBundle + &quot; FLAC&quot;);
          System.out.println(vidBundle + &quot; VID&quot;);
          System.out.println(&quot;&quot;);
          System.out.println(&quot;Calculating...Please wait...&quot;);
          try {
              TimeUnit.SECONDS.sleep(3);
          } catch (InterruptedException ie) {
              Thread.currentThread().interrupt();
          }
      }
  }
  </code></pre>
  <p>An Error occurred</p>
  <pre><code>Exception in thread &quot;main&quot; java.util.NoSuchElementException
      at java.base/java.util.Scanner.throwFor(Scanner.java:937)
      at java.base/java.util.Scanner.next(Scanner.java:1594)
      at java.base/java.util.Scanner.nextInt(Scanner.java:2258)
      at java.base/java.util.Scanner.nextInt(Scanner.java:2212)
      at BundlesCalculator.Main.takeInput(Main.java:65)
      at BundlesCalculator.Main.main(Main.java:43)
  </code></pre>
  <p>However, I wrote the same code in a simple Java Application without Gradle, there is no issue occurred.
  I just wonder what did I do incorrectly?</p>