JInput introduction

Firstly, thanks a lot for the help, I really appreciate it! But if ye could just bear with me, I have downloaded the files and extracted them to a folder C:\Java.

I went to environmental variables and in “user variables” I appended C:\Java\jinput.jar to the CLASSPATH. Is that correct?
Do I have to add anything in the system variables beneath?
Also, to set the -Dpath library.path thing, where do i do that and also could you give an example of using this command?

I know I’m asking alot but there is nowhere else I can go, I would really appreciate if you could help me further.

Thank you.

bump

Erm, it would work, but it’s not the recommended way.

I sugest you do some research on the java command line. Type ‘java’ on the dos prompt to get a list of the switches you can use. Take particular not of the -D and -cp switches.

Are you trying to use jinput in an existing app? or just run the tests?

Endolf

well first I would like to figure out how to use it if i got it up and running by doing some test apps. Then i would be using it in a game app

Hi

There is a jar on jinput.dev.java.net in the core folder called test jar. Download that. It contains 3 tests for jinput, 1 lists all the components of all found controllers. The second opens windows up that show you the status of the controllers so you can see them when you move joysticks/press buttons/keys etc, and the 3rd rumbles any rumblers it finds.

To run it, from a dos prompt run

java -cp <pathtotest.jar>;<pathtojinput.jar> -Djava.library.path=<pathtonativelibs> net.java.games.input.ControllerTextTest
java -cp <pathtotest.jar>;<pathtojinput.jar> -Djava.library.path=<pathtonativelibs> net.java.games.input.ControllerReadTest
java -cp <pathtotest.jar>;<pathtojinput.jar> -Djava.library.path=<pathtonativelibs> net.java.games.input.RumbleTest

to run the 3 tests.

e.g. if you have the test jar, the jinput jar and the natives .dll/.so etc in the current directory

java -cp jinput-tests-20060514.jar;jinput.jar -Djava.library.path=. net.java.games.input.ControllerTextTest

HTH

Endolf

Ok I did what u said to do the tests and put all the files listed below into a folder and went to that folder in command prompt and ran:

java -cp jinput-tests-20060514.jar;jinput.jar -Djava.library.path=. net.java.games.input.ControllerTextTest

and it says it cant find the class net/java/games/input/ControllerTextTest

the files i have in this folder are:

jinput.jar
jinput-dx8.dll
jinput-raw.dll
jinput-tests-20060514.jar
libjinput-linux.so
libjinput-osx.jnilib

Do you know why it cant find the classes in the test jar?

Thanks,
Jim.

Hi

My mistake, the class name is net.java.games.input.test.ControllerTextTest not what I said before.

HTH

Endolf

Hey cool it worked :slight_smile: Does this mean I have the right stuff in the right places? like i can start reading tutorials on how to program using it?

Thanks for the help

Yup :slight_smile:

Try ControllerReadTest and RumbleTest too if you have rumblers in the controllers :slight_smile:

Endolf

Ok endolf thanks very much, really appreciate it. Gonna read up on the stuff soon.

Jim.

Hi

I was trying to do as instructed in this thread, but while running the command:

java -cp jinput-tests-20060514.jar;jinput.jar -Djava.library.path=. net.java.games.input.test.ControllerTextTest

but it didn’t worked. but if I change the “;” with “:” it seems to work. can anyone tell me, why?

thanks.

What OS are you on?

Windows uses ‘;’ as it’s classpath seperator, Linux uses ‘:’, not sure what OSX uses, but I’d guess at ‘:’ like Linux

Endolf

Hi

I am running it on Linux (fedora core) indeed.
Thanks for the info. But it took 2 hours for me to notice between “;” and “:” :stuck_out_tongue:

Btw, where can I get the source code of the test program?

Thanks.

It’s all in CVS over at jinput.dev.java.net

HTH

Endolf