Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (526)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (593)
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 5489 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:

plugins/linux/src/native/libjinput.so

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

Ubuntu
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 »

Hi
 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 libjinput.so 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 libjinput.so and linux.jar to the controller directory so I ended up with

1  
2  
3  
4  
./jinput.jar
./jutils.jar
./controller/libjinput.so
./controller/linux.jar


and then ran

1  
java -cp jinput.jar:jutils.jar net.java.games.input.test.ControllerTextTest

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

1  
2  
3  
4  
5  
6  
java -cp coreAPI/bin/jinput.jar:\
coreAPI/lib/jutils.jar:\
plugins/linux/bin/linux.jar \
-Djava.library.path=plugins/linux/src/native \
-Djinput.plugins=net.java.games.input.LinuxEnvironmentPlugin \
net.java.games.input.test.ControllerTextTest

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

Cheers

Endolf

Offline Conzar

Junior Devvie




There is nothing common about common sense


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

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

I ran the  net.java.games.input.test.ControllerTextTest 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 KeyboardTest.java 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?

Thanks



1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
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 plugins:net.java.games.input.LinuxEnvironmentPlugin
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(KeyboardTest.java:20)
        at KeyboardTest.<init>(KeyboardTest.java:15)
        at KeyboardTest.main(KeyboardTest.java:32)

Ubuntu
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 »

Hi
 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.

HTH

Endolf

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/libjinput.so

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/libjinput.so
<some dir>/controller/linux-plugin1.2/linux.jar [same file as above]
<some dir>/controller/linux-plugin1.2/libjinput.so [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/libjinput.so
<some dir>/controller/fob-linux/fob-jinput-linux.jar
<some dir>/controller/fob-linux/libfobjinput.so

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.

cya

TheBohemian

---------------------------------------
my favorite OS: http://jnode.sf.net
Java 1.5 -> 1.4 converter: http://retroweaver.sf.net
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!

http://wiki.java.net/bin/view/Games/JeffFAQ
Pages: 1 [2]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

toopeicgaming1999 (71 views)
2014-11-26 15:22:04

toopeicgaming1999 (60 views)
2014-11-26 15:20:36

toopeicgaming1999 (14 views)
2014-11-26 15:20:08

SHC (27 views)
2014-11-25 12:00:59

SHC (25 views)
2014-11-25 11:53:45

Norakomi (31 views)
2014-11-25 11:26:43

Gibbo3771 (25 views)
2014-11-24 19:59:16

trollwarrior1 (38 views)
2014-11-22 12:13:56

xFryIx (77 views)
2014-11-13 12:34:49

digdugdiggy (55 views)
2014-11-12 21:11:50
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org 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‑gaming.org
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!