title: LWJGL Controllers in IntelliJ
body: <p>Every time I try to build a basic example program for using LWJGL controllers, it crashes. Here's the code:</p>
  
  <pre><code>package com.czipperz.blogspot.tests.controllers;
  
  
  import org.lwjgl.LWJGLException;
  import org.lwjgl.input.Controller;
  import org.lwjgl.input.Controllers;
  
  /**
   * Created by Chris on 10/23/2014.
   */
  public class Main {
  //left joystick x and y
  private float x, y,
  //right joystick x and y.  Like the commas?
                rx, ry;
  //This Controller object MUST BE org.lwjgl.input.Controller NOT net.java.games.input.Controller
  private Controller c;
  private boolean start;
  
  public static final int BUTTON_A = 1, BUTTON_B = 2, BUTTON_X = 3, BUTTON_Y = 4,
                          BUTTON_LEFT_BUMPER = 5, BUTTON_RIGHT_BUMPER = 6, BUTTON_SELECT = 7, BUTTON_START = 8,
                          //When you PRESS the joysticks (click)
                          BUTTON_LEFT_JOYSTICK = 9, BUTTON_RIGHT_JOYSTICK = 10;
  
  public static void main(String[] args) {
      new Main();
  }
  
  public Main() {
      //Says, find controllers and store them in the Controllers class to JInput. Dont worry bout it.
      try {
          Controllers.create();
      } catch (LWJGLException e) {
          e.printStackTrace();
      }
      // Gets you a shiny "new" controller instance.
      // Think of index like you would think of an array.
      c = Controllers.getController(0);
  
      //Sets "deadband"
      float dead = .06f;
      c.setXAxisDeadZone(dead);
      c.setYAxisDeadZone(dead);
      c.setRXAxisDeadZone(dead);
      c.setRYAxisDeadZone(dead);
  
      //Using the controller requires you to call the poll() function to receive new data.
      c.poll();
      x = c.getXAxisValue();
      y = c.getYAxisValue();
      rx = c.getRXAxisValue();
      ry = c.getRYAxisDeadZone();
      //NOTE: getZAxisValue(), getRZAxisValue(), getZAxisDeadZone(), getRZAxisDeadZone() DO NOT WORK
  
      //DPAD = POV
      float povx = c.getPovX();
      float povy = c.getPovY();
  
      boolean lbumper = c.isButtonPressed(BUTTON_LEFT_BUMPER);
  }
  }
  </code></pre>
  
  <p>The problem is that every time I build, this is the log: (Sorry I just can't hit space that many times)</p>
  
  <pre><code>"C:\Program Files\Java\jdk1.8.0_25\bin\java" -Didea.launcher.port=7533 "-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains IntelliJ IDEA Community Edition 13.1.5\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\Java\jdk1.8.0_25\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_25\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_25\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.8.0_25\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_25\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_25\jre\lib\jfxswt.jar;C:\Program Files\Java\jdk1.8.0_25\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_25\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.8.0_25\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.8.0_25\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_25\jre\lib\rt.jar;C:\Program Files\Java\jdk1.8.0_25\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.8.0_25\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_25\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_25\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_25\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_25\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_25\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_25\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_25\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_25\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_25\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.8.0_25\jre\lib\ext\zipfs.jar;C:\Users\Chris\workspace\Controllers\out\production\Controllers;C:\Users\Chris\workspace\lwjgl-2.9.1\jar\lzma.jar;C:\Users\Chris\workspace\lwjgl-2.9.1\jar\lwjgl.jar;C:\Users\Chris\workspace\lwjgl-2.9.1\jar\jinput.jar;C:\Users\Chris\workspace\lwjgl-2.9.1\jar\lwjgl_test.jar;C:\Users\Chris\workspace\lwjgl-2.9.1\jar\lwjgl_util.jar;C:\Users\Chris\workspace\lwjgl-2.9.1\jar\lwjgl-debug.jar;C:\Users\Chris\workspace\lwjgl-2.9.1\jar\asm-debug-all.jar;C:\Users\Chris\workspace\lwjgl-2.9.1\jar\lwjgl_util_applet.jar;C:\Users\Chris\workspace\lwjgl-2.9.1\jar\AppleJavaExtensions.jar;C:\Program Files (x86)\JetBrains IntelliJ IDEA Community Edition 13.1.5\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain com.czipperz.blogspot.tests.controllers.Main
  WARNING: Found unknown Windows version: Windows 8.1
  Attempting to use default windows plug-in.
  Loading: net.java.games.input.DirectAndRawInputEnvironmentPlugin
  java.lang.UnsatisfiedLinkError: no jinput-dx8_64 in java.library.path
  at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1857)
  at java.lang.Runtime.loadLibrary0(Runtime.java:870)
  at java.lang.System.loadLibrary(System.java:1119)
  at net.java.games.input.DirectInputEnvironmentPlugin$1.run(DirectInputEnvironmentPlugin.java:75)
  at java.security.AccessController.doPrivileged(Native Method)
  at          net.java.games.input.DirectInputEnvironmentPlugin.loadLibrary(DirectInputEnvironmentPlugin.java:67)
  at net.java.games.input.DirectInputEnvironmentPlugin.&lt;clinit&gt;(DirectInputEnvironmentPlugin.java:109)
  at net.java.games.input.DirectAndRawInputEnvironmentPlugin.&lt;init&gt;(DirectAndRawInputEnvironmentPlugin.java:45)
  at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
  at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
  at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
  at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
  at java.lang.Class.newInstance(Class.java:438)
  at net.java.games.input.DefaultControllerEnvironment.getControllers(DefaultControllerEnvironment.java:157)
  at org.lwjgl.input.Controllers.create(Controllers.java:71)
  at com.czipperz.blogspot.tests.controllers.Main.&lt;init&gt;(Main.java:32)
  at com.czipperz.blogspot.tests.controllers.Main.main(Main.java:26)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:483)
  at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
  java.lang.UnsatisfiedLinkError: no jinput-raw_64 in java.library.path
  at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1857)
  at java.lang.Runtime.loadLibrary0(Runtime.java:870)
  at java.lang.System.loadLibrary(System.java:1119)
  at net.java.games.input.RawInputEnvironmentPlugin$1.run(RawInputEnvironmentPlugin.java:75)
  at java.security.AccessController.doPrivileged(Native Method)
  at net.java.games.input.RawInputEnvironmentPlugin.loadLibrary(RawInputEnvironmentPlugin.java:67)
  at net.java.games.input.RawInputEnvironmentPlugin.&lt;clinit&gt;(RawInputEnvironmentPlugin.java:109)
  at net.java.games.input.DirectAndRawInputEnvironmentPlugin.&lt;init&gt;    (DirectAndRawInputEnvironmentPlugin.java:46)
  at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
  at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
  at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
  at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
  at java.lang.Class.newInstance(Class.java:438)
  at net.java.games.input.DefaultControllerEnvironment.getControllers(DefaultControllerEnvironment.java:157)
  at org.lwjgl.input.Controllers.create(Controllers.java:71)
  at com.czipperz.blogspot.tests.controllers.Main.&lt;init&gt;(Main.java:32)
  at com.czipperz.blogspot.tests.controllers.Main.main(Main.java:26)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:483)
  at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
  Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
  at java.util.ArrayList.rangeCheck(ArrayList.java:653)
  at java.util.ArrayList.get(ArrayList.java:429)
  at org.lwjgl.input.Controllers.getController(Controllers.java:116)
  at com.czipperz.blogspot.tests.controllers.Main.&lt;init&gt;(Main.java:38)
  at com.czipperz.blogspot.tests.controllers.Main.main(Main.java:26)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:483)
  at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
  net.java.games.input.DirectAndRawInputEnvironmentPlugin is not supported
  
  Process finished with exit code 1
  </code></pre>