Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (406)
games submitted by our members
Games in WIP (289)
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 1456 times)
0 Members and 1 Guest are viewing this topic.
Offline wrAthchild

Senior Newbie





« Posted 2008-07-13 16: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 18: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 23: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.

Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars and Titan!

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

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (60 views)
2013-05-17 21:29:12

alaslipknot (69 views)
2013-05-16 21:24:48

gouessej (99 views)
2013-05-16 00:53:38

gouessej (97 views)
2013-05-16 00:17:58

theagentd (107 views)
2013-05-15 15:01:13

theagentd (98 views)
2013-05-15 15:00:54

StreetDoggy (144 views)
2013-05-14 15:56:26

kutucuk (167 views)
2013-05-12 17:10:36

kutucuk (166 views)
2013-05-12 15:36:09

UnluckyDevil (175 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
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!
Page created in 0.096 seconds with 21 queries.