title: Need to run Java code in GWT
body: <p>I created a new google web application project (using eclipse) and noticed the code runs in the .server package.  I have a slot machine game i wrote in java and am trying to implement it into GWT, but the syntax seems to be totally different. (for example, i noticed \n doesn't work)</p>
  
  <p>Here is the code i want to implement - how the heck would i do that?</p>
  
  <pre><code>// clear console
  static void clearConsole()
  {
      for (int i=0; i&lt;25; i++)
      {
          System.out.println("\n");
      }
  }
  
  
  // actual slot machine algorithm
  static void slots()
  {
  
      Scanner input = new Scanner (System.in);
  
      char newGame = ' ';
  
      int chips = 100;
      int bet = 0;
  
  
      do{
           System.out.println( "Try your luck on the SLOT MACHINE." +
                   "\nLine up (=^^=) or ))&lt;&gt;(( symbols to win big!\n\n" +
                  "You currently have " + chips + " chips.\nHow much do you want to bet? ");
  
  
  
           //check for accidental char input
           try{
               bet = input.nextInt();
  
           }
           catch(Exception e){
  
               input.nextLine();
               System.out.println("NOT A VALID NUMBER\nHow much do you want to bet? ");
               bet = input.nextInt();
           }
  
  
  
          if (bet&lt;=chips &amp;&amp; bet&gt;0){
  
              // to add some realism, slot machine will not execute until 'enter' pressed
              // then console cleared
              input.nextLine();
              System.out.println( "\nPress 'enter' to start the slot machine.");
              input.nextLine();
              clearConsole();
  
              String[] machine = {"(=^^=)", "(=^^=)", "))&lt;&gt;((", " XXXX ", " XXXX ", " :^{) ",
                                    " :^{) ", " (&gt;_&lt;)", " (&gt;_&lt;)", " [-O-]", " [-O-]"}; 
              Random rand = new Random();
              int slot1 = rand.nextInt(11);
              int slot2 = rand.nextInt(11);
              int slot3 = rand.nextInt(11);
              int slot4 = rand.nextInt(11);
              int slot5 = rand.nextInt(11);
              int slot6 = rand.nextInt(11);
              int slot7 = rand.nextInt(11);
              int slot8 = rand.nextInt(11);
              int slot9 = rand.nextInt(11);
  
              System.out.println( "-----------------------");
              System.out.printf( "%-7s %-7s %-7s %n%n", machine[slot1], machine[slot2], machine[slot3]);
              System.out.printf( "%-7s %-7s %-7s %n%n", machine[slot4], machine[slot5], machine[slot6]);
              System.out.printf( "%-7s %-7s %-7s %n", machine[slot7], machine[slot8], machine[slot9]);
              System.out.println( "-----------------------\n\n\n\n");
  
              // 3 wild cards
              if (slot4 == 2 &amp;&amp; slot5 == 2 &amp;&amp; slot6 == 2 ){
                  bet = bet*100;
                  chips = chips + bet;
                  System.out.println( "JACKPOT! ");
              }
  
              //3 cats (inclusive of wild card)
              else if (   slot4 &lt;3 &amp;&amp; slot5 &lt;3 &amp;&amp; slot6 &lt;3 ){
                  bet = bet*5;
                  chips = chips + bet;
                  System.out.println( "YOU WIN! ");
              }
  
              // 3 of any other symbol (inclusive of wild card)
              else if( ((slot4==2 || slot4==3 || slot4==4) &amp;&amp; (slot5==2 || slot5==3 || 
                                              slot5==4) &amp;&amp; (slot6==2 || slot6==3 || slot6==4))
                      || ((slot4==2 || slot4==5 || slot4==6) &amp;&amp; (slot5==2 || slot5==5 || 
                                              slot5==6) &amp;&amp; (slot6==2 || slot6==5 || slot6==6))
                      || ((slot4==2 || slot4==7 || slot4==8) &amp;&amp; (slot5==2 || slot5==7 || 
                                              slot5==8) &amp;&amp; (slot6==2 || slot6==7 || slot6==8))
                      || ((slot4==2 || slot4==9 || slot4==10) &amp;&amp; (slot5==2 || slot5==9 || 
                                         slot5==10) &amp;&amp; (slot6==2 || slot6==9 || slot6==10)) ){
                  bet = bet*3;
                  chips = chips + bet;
                  System.out.println( "YOU WIN! ");
              }
  
              // 2 cats
              else if ( slot4&lt;2 &amp;&amp; slot5&lt;2 || slot4&lt;2 &amp;&amp; slot6&lt;2 || slot5&lt;2 &amp;&amp; slot6&lt;2){
                  bet = bet*2;
                  chips = chips + bet;
                  System.out.println( "YOU WIN! ");
              }
  
              // 1 cat
              else if ( slot4 &lt; 2 || slot5 &lt; 2 || slot6 &lt; 2 ){
                  chips = chips + bet;
                  System.out.println( "YOU WIN! ");
              }
  
              // nothing
              else{
                  chips = chips - bet;
                  System.out.print( "You Lose... ");
              }
  
              // display current amount of chips
              System.out.println( "You have " + chips + " chips.");
  
  
           }else{
              System.out.println( "You do not have enough chips to make that bet!");
           }
  
  
          if (chips &gt; 0){
              System.out.println( "\nDo you wanna play this game again? (y/n): ");
              newGame = input.next().charAt(0);
              clearConsole();
          }
  
      } while (newGame =='y' &amp;&amp; chips &gt; 0 );
  
  
      input.close();
  
      System.out.println( "\nGame Over\n\n");
  }
  </code></pre>