Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (780)
Games in Android Showcase (233)
games submitted by our members
Games in WIP (857)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: 1 [2]
  ignore  |  Print  
  how to get JInput to work under linux?  (Read 12533 times)
0 Members and 1 Guest are viewing this topic.
Offline Conzar

Junior Devvie

There is nothing common about common sense

« Reply #30 - Posted 2004-03-18 18:02:24 »

so I put the following dir struction in the same directory as my program and it doesn't work:


This is the same as whats in the nightly builds as well as cvs.

Offline endolf

JGO Coder

Medals: 7
Exp: 15 years

Current project release date: sometime in 3003

« Reply #31 - Posted 2004-03-19 06:35:36 »

 Ok, I was wrong, the binaries are not right. In your classpath you need jinput.jar and jutils.jar then in the directory you run from you need a controller directory that contains and linux.jar

The test I did was to create a new empty directory, I copied the jinput.jar and jutils.jar to that directory, I created a controller directory and copied and linux.jar to the controller directory so I ended up with


and then ran

java -cp jinput.jar:jutils.jar

it found the linux plugin fine.

You can move jinput.jar and jutils.jar around as long as you update your classpath. If you move the plugin then you must use the plugin property to cope.

For example, with a fresh copy of the binary the following command works

java -cp coreAPI/bin/jinput.jar:\
plugins/linux/bin/linux.jar \
-Djava.library.path=plugins/linux/src/native \ \

Note that the library path needs to be updated so that the .so can be loaded.



Offline Conzar

Junior Devvie

There is nothing common about common sense

« Reply #32 - Posted 2004-03-19 13:23:25 »

That clears a bunch up.  Thank you for posting that mini-howto.

I ran the and all it did was show that it indeed found the linux plugin but thats all it did.  I am guessing that it couldn't find any devices and so exited.  

Thats what happened to the previous program did when I ran it (below is the output of that prog --- it gets a null pointer b/c it needs at least 1 device there for it to work properly).  

Anyways, I am running the 2.6.1 kernel so shouldn't the keyboard and mouse be reconigzed by jinput?


mspeth@fmp keyboard $ ./run
Scanning jar: linux.jar
Examining file : META-INF/
Examining file : META-INF/MANIFEST.MF
Examining file : net/
Examining file : net/java/
Examining file : net/java/games/
Examining file : net/java/games/input/
Examining file : net/java/games/input/LinuxDevice$LinuxHat.class
Examining file : net/java/games/input/LinuxDevice$ButtonID.class
Examining file : net/java/games/input/LinuxDevice$1.class
Examining file : net/java/games/input/LinuxDevice.class
Examining file : net/java/games/input/LinuxAxis.class
Examining file : net/java/games/input/LinuxEnvironmentPlugin.class
Found candidate class: net/java/games/input/LinuxEnvironmentPlugin.class
Adding class to
Examining file : net/java/games/input/LinuxKeyboard$KeyID.class
Examining file : net/java/games/input/LinuxKeyboard.class
Examining file : net/java/games/input/LinuxMouse$LinuxMouseBall.class
Examining file : net/java/games/input/LinuxMouse$LinuxMouseButtons.class
Examining file : net/java/games/input/LinuxMouse$LinuxMouseButton.class
Examining file : net/java/games/input/LinuxMouse.class
Examining file : net/java/games/input/LinuxNativeTypesMap.class
Examining file : net/java/games/input/NativeDefinitions.class
cont: 0
Exception in thread "main" java.lang.NullPointerException
        at KeyboardTest.keyboardupdate(
        at KeyboardTest.<init>(
        at KeyboardTest.main(

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline endolf

JGO Coder

Medals: 7
Exp: 15 years

Current project release date: sometime in 3003

« Reply #33 - Posted 2004-03-19 14:18:05 »

 glad it's finding the plugin now. The output from ControllerTextTest would be far more useful. I can't do it now, but there is an option in the native build.xml that can be set to have the library dump a whole load of debug at runtime, I think i might try setting it in this case.
 You are right, under 2.6.* if you have a k/b plugged in it should be detected, if you have a mouse installed with a driver (usb, ps/2) then it should pick that up too. As long as you have /dev/input/event* devices for them that is, and with read and write permissions for the user running the code.



Offline TheBohemian

Junior Devvie

Java will rule them all!

« Reply #34 - Posted 2004-03-24 11:13:45 »

Although placing the plugin files inside the 'controller' directory works nice I think it was meant more like this:

<some dir>/controller/linux-plugin/linux.jar
<some dir>/controller/linux-plugin/

The reason for that additional directory is to handle different version of the same library. eg:

<some dir>/controller/linux-plugin1.0/linux.jar
<some dir>/controller/linux-plugin1.0/
<some dir>/controller/linux-plugin1.2/linux.jar [same file as above]
<some dir>/controller/linux-plugin1.2/ [updated or simply a custom build]

This will actually double the amount of devices available to your apps when you do that with two identical plugins.
So imagine someone writes that "flock of birds"-plugin it can be installed like this.

<some dir>/controller/linux-plugin/linux.jar
<some dir>/controller/linux-plugin/
<some dir>/controller/fob-linux/fob-jinput-linux.jar
<some dir>/controller/fob-linux/

Currently nobody will run into problems by not using an additional subdirectory but as soon as there is more than one plugin available for a specific platform confusion may start.



my favorite OS:
Java 1.5 -> 1.4 converter:
Offline Jeff

JGO Coder

Got any cats?

« Reply #35 - Posted 2004-04-04 21:28:45 »

yes. It was also desigend that way for another reason.

People tend to name their DLLs with common names.  Things like "joystick.dll".  These can clash if ist all in one directory and make it impossible to use two plug-ins together.

A jar name clash can be sovled by renaming the Jar but the DLL name is hrdocded generally in the jar and can't be changed.

The subdirectory system is ther to support different plugins, written independantly, that share DLL (or for that matter jar) names.

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!
Pages: 1 [2]
  ignore  |  Print  

hadezbladez (1165 views)
2018-11-16 13:46:03

hadezbladez (525 views)
2018-11-16 13:41:33

hadezbladez (1185 views)
2018-11-16 13:35:35

hadezbladez (272 views)
2018-11-16 13:32:03

EgonOlsen (2567 views)
2018-06-10 19:43:48

EgonOlsen (2786 views)
2018-06-10 19:43:44

EgonOlsen (1564 views)
2018-06-10 19:43:20

DesertCoockie (2267 views)
2018-05-13 18:23:11

nelsongames (2120 views)
2018-04-24 18:15:36

nelsongames (2814 views)
2018-04-24 18:14:32
Deployment and Packaging
by philfrei
2019-02-17 20:25:53

Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45

Deployment and Packaging
by philfrei
2018-08-20 02:33:38

Deployment and Packaging
by philfrei
2018-08-20 02:29:55

Deployment and Packaging
by philfrei
2018-08-19 23:56:20 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!