Java-Gaming.org Hi !
Featured games (81)
games approved by the League of Dukes
Games in Showcase (513)
Games in Android Showcase (119)
games submitted by our members
Games in WIP (576)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Problem with JAR + dxinput.dll  (Read 1708 times)
0 Members and 1 Guest are viewing this topic.
Offline wrAthchild

Senior Newbie





« Posted 2008-07-13 14:10:53 »

Hello

I was hoping for some input on a very annoying problem of mine. Feeling is it must have a simple solution... I did some searching this forum before posting, didn't find any tip, so...:

I've made a simple game which uses JInput, more specifically I use a gamepad to play it. Everythings works as expected in my IDE (NetBeans) so no problem here. However, I'm trying to bundle everything in an executable JAR (in the unlikely event that someone actually wants to try it Smiley). This works almost as expected; code, images and sound are all OK, but the most important piece is missing, the gamepad functionality...

Both the plugins and native files are included in JAR (lib/native, lib/plugin, lib/runtime). Im using a class loader (http://www.jdotsoft.com/JarClassLoader.php) which handles the JAR creation. The docs concerning this loader states that all files, including native ones, can be placed at any location within the JAR; the loader will find them. But somehow the gamepad functionality is not there when running the JAR hmmm.

I have tried to manually set the java library path (absolute), to point at dxinput.dll, as follows:

1  
2  
3  
4  
5  
6  
7  
8  
try {
    System.setProperty("java.library.path", "c:/MinAppFolder/MinApp/");
    System.load("c:/MinAppFolder/MinApp/dxinput.dll");
    // also tried System.loadLibrary("dxinput.dll") here...
}
catch(UnsatisfiedLinkError e) {
    System.out.println(e);
}


The above code being placed first in the program main-method. It's of course not ideal, but I did this just to test if I could get it to work at all...
No luck with this option either :/ (I'm never getting UnsatisfiedLinkError though)

Have any of you experienced this problem aswell? I would really appreciate some help with this, feels like I've tried all options. What am I doing wrong?

/ Anders
Offline wrAthchild

Senior Newbie





« Reply #1 - Posted 2008-07-13 16:36:15 »

Been looking around some more in this forum and it seems like many of you actually got this to work; being able to deploy through JWS etc, suggests that you either never had this problem, or have overcome it.

Looking forward to hearing your solutions Smiley Want to get this up and running....so many hours..

/ Anders
Offline wrAthchild

Senior Newbie





« Reply #2 - Posted 2008-07-13 21:50:20 »

Ok, it seems like a solution has arrived Smiley

The best part is that the native files are actually located and loaded from within the JAR (which I didn't think was easily doable). Not been setting a single java.library.path. I have yet to work out all the details, but I successfully managed to interact with my app (executed by JAR) through a gamepad.

First of all I have been using an old version of JInput (just used the same files I found in a tutorial ("jinputTutorialOne" I think). That version included only one dll file, dxinput.dll. I got the latest via link in "Getting started..." Smiley. Found out that the Axis class (of older version) was removed so I had to modify (in the process of doing this Smiley) some methods in my app to make it work. Great relief to see the gamepad responding at last, when running my app-jar!

/ Anders
Pages: [1]
  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.

Longarmx (39 views)
2014-10-17 03:59:02

Norakomi (30 views)
2014-10-16 15:22:06

Norakomi (24 views)
2014-10-16 15:20:20

lcass (28 views)
2014-10-15 16:18:58

TehJavaDev (57 views)
2014-10-14 00:39:48

TehJavaDev (58 views)
2014-10-14 00:35:47

TehJavaDev (48 views)
2014-10-14 00:32:37

BurntPizza (64 views)
2014-10-11 23:24:42

BurntPizza (36 views)
2014-10-11 23:10:45

BurntPizza (78 views)
2014-10-11 22:30:10
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!