title: Java RPi GPIO issue at runtime
body: <p>My Code Is This</p>
  
  <pre><code>package me.Andrew.Keypad.Listener;
  
  import java.util.HashMap;
  
  import com.pi4j.io.gpio.GpioController;
  import com.pi4j.io.gpio.GpioFactory;
  import com.pi4j.io.gpio.GpioPinDigitalInput;
  import com.pi4j.io.gpio.GpioPinDigitalOutput;
  
  import me.Andrew.Keypad.Main;
  
  public class ButtonInput {
      public boolean isRunning = false;
      public GpioController gpio = GpioFactory.getInstance();
      Main MA = Main.getInstance();
  
      public HashMap&lt;String, GpioPinDigitalInput&gt; ColPins = null;
      public HashMap&lt;String, GpioPinDigitalOutput&gt; RowPins = null;
  
      public void start() {
          isRunning = true;
          ButtonListener();
      }
  
      public void stop() {
          isRunning = false;
      }
  
      private int ScanRow(int row) {
          int Col = 0;
          RowPins.get(String.valueOf(row)).high();
          if (ColPins.get("1").isHigh()) {
              Col = 1;
          } else if (ColPins.get("2").isHigh()) {
              Col = 2;
          } else if (ColPins.get("3").isHigh()) {
              Col = 3;
          } else if (ColPins.get("4").isHigh()) {
              Col = 4;
          }
          return Col;
      }
  
      private void ButtonListener() {
  
          Main.GPIOMeths.setupPins();
          RowPins = Main.store.RowPins;
          ColPins = Main.store.ColPins;
  
          int Response = 0;
  
          while (isRunning == true) {
              if (isRunning) {
                  Response = ScanRow(1);
  
                  if (Response == 1) {
                      stop();
                      buttonPressEvent("1");
                      break;
                  }else if (Response == 2) {
                      stop();
                      buttonPressEvent("2");
                      break;
                  }else if (Response == 3) {
                      stop();
                      buttonPressEvent("3");
                      break;
                  }else if (Response == 4) {
                      stop();
                      buttonPressEvent("A");
                      break;
                  }
  
                  int Responsee = ScanRow(2);
                  if (Responsee != 0) {
                      stop();
                      String BP = Main.Meths.getButton(2, Responsee);
                      buttonPressEvent(BP);
                      break;
                  }
  
                  int Responseee = ScanRow(3);
                  if (Responseee != 0) {
                      stop();
                      String BP = Main.Meths.getButton(3, Responseee);
                      buttonPressEvent(BP);
                      break;
                  }
  
                  int Responseeee = ScanRow(4);
                  if (Responseeee != 0) {
                      stop();
                      String BP = Main.Meths.getButton(4, Responseeee);
                      buttonPressEvent(BP);
                      break;
                  }
              }
  
          }
      }
  
      public void buttonPressEvent(String ButtonPressed) {
          // String ButtonPressed = Main.Meths.getButton(Row, Col);
          if (ButtonPressed.equalsIgnoreCase("*")) {
              System.out.println("Code Logging Started");
              Main.store.CodeMode = true;
              Main.store.CodeEntered = "";
          } else if (ButtonPressed.equalsIgnoreCase("#")) {
              System.out.println("Code Logging Ended");
              if (Main.Meths.CompareCodes()) {
                  System.out.println("Code Correct");
              } else {
                  System.out.println("Code Incorrect");
              }
              Main.store.CodeMode = false;
          } else {
              if (Main.store.CodeMode == false) {
                  System.out.println("Code Logging Not Running: " + ButtonPressed);
              } else {
                  Main.store.CodeEntered = Main.store.CodeEntered + ButtonPressed;
                  System.out.println("Code Entered: " + Main.store.CodeEntered);
              }
          }
          try {
              Thread.sleep(500);
          } catch (InterruptedException e) {
          } finally {
              start();
          }
  
      }
  }
  </code></pre>
  
  <p>But when i run it and press 1,2,3,A All of the top row i get this response</p>
  
  <p>root@raspberrypi:/home/pi# java -jar /home/pi/keypad.jar
  Code Logging Not Running: 7
  Code Logging Not Running: 0
  Code Logging Not Running: 9
  Code Logging Not Running: A</p>
  
  <p>Code Logging Not Running: 7
  Code Logging Not Running: 5
  Code Logging Not Running: 3
  Code Logging Not Running: A</p>