1
您好我正在嘗試在Java中製作遊戲,讓用戶可以選擇操縱桿或遊戲手柄來控制移動。所以我找到了一種叫做「JInput」的東西,它可以很容易地檢測到所有連接的遊戲控制器。問題是,當我在Eclipse中運行它時,出現以下錯誤:「java.lang.UnsatisfiedLinkError:java.library.path中沒有jinput-dx8」。JInput java.library.path中的「no jinput-dx8」錯誤
我的代碼如下:
import net.java.games.input.*;
public class ListControllers
{
public static void main(String[] args)
{
System.out.println("JInput version: " + Version.getVersion());
ControllerEnvironment ce =
ControllerEnvironment.getDefaultEnvironment();
Controller[] cs = ce.getControllers();
if (cs.length == 0) {
System.out.println("No controllers found");
System.exit(0);
}
// print the name and type for each controller
for (int i = 0; i < cs.length; i++)
System.out.println(i + ". " +
cs[i].getName() + ", " + cs[i].getType());
} // end of main()
} // end of ListControllers class
我目前在Windows 7環境中進行開發。任何幫助將非常感激。
現在完美運作,謝謝! – Petezah 2010-01-12 20:09:18