Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (580)
games submitted by our members
Games in WIP (500)
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  
  jinput and Java 1.6.0_10  (Read 7237 times)
0 Members and 1 Guest are viewing this topic.
Offline beermann

Senior Newbie





« Posted 2008-10-01 22:55:00 »

We're having some problems with Java 1.6.0_10-rc and Java 1.6.0_10-rc2.  When running our code through Eclipse everything works fine.  When running through an applet, no events are coming through.  If I switch to running 1.6.0_7 or earlier JVMs, everything works fine.

I've tracked the problem as far as the addKeyboardEvent not getting called from the native libraries.  It seems as though the events just aren't making it into java.

When starting the application, this line is displayed both when running through Eclipse and running through the applet:
Loading: net.java.games.input.DirectAndRawInputEnvironmentPlugin

There are no exceptions in the console.  My guess is that this is an issue with the release candidates for update 10 but I can't really debug things any further than this.

Has anyone else seen this?  Is there any fix that I can make in the code?

There is a test application we made here: http://beta.sharendipity.com/assets/1369/.  The 'g' key will work because it is using Java's key listener architecture, but pressing the other keys will not as they are going through jinput.

Thank you,

Dale
Offline endolf

JGO Knight


Medals: 7
Projects: 1


Current project release date: sometime in 3003


« Reply #1 - Posted 2008-10-02 19:09:08 »

Hi

I what permissions are you asking for with your applet?, I just checked and the webstart works fine with 1.6.0_10-rc, but your applet doesn't. I looked in the java logs in C:\Documents and Settings\<username>\Application Data\Sun\Java\Deployment\log and the plugin<pid> log file has some access control exceptions
1  
java.security.AccessControlException: access denied (java.util.PropertyPermission user.home read)

unfortunatly there is no stack trace there, but the jinput plugin mechanism will try to get the user.home property IIRC.

HTH

Endolf

Offline beermann

Senior Newbie





« Reply #2 - Posted 2008-10-03 17:15:08 »

Thank you for the response.

We are signed, so we don't explicitly ask for any permissions.  We do access the user.home system property as well because we have our own launcher that downloads jars and stores them there.  I would also be surprised that the behavior with respect to system security would be different between versions of Java.

Is there any way to tell how jinput would be failing if it could not access user.home?  It seems as though things are nearly identical between versions of java.  In both cases, during debug I see that we have a RawKeyboard and a RawDevice that are being used.  The only difference I can tell is that addKeyboardEvent in RawInputEventQueue is never getting called.

I'm curious if anyone knows of other applets that utilize jinput so that I could see if they work with this version of Java. 

Thanks again,

Dale
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Online Riven
« League of Dukes »

JGO Overlord


Medals: 605
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #3 - Posted 2008-10-06 12:41:08 »

System.getSecurityManager() == null ?

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline endolf

JGO Knight


Medals: 7
Projects: 1


Current project release date: sometime in 3003


« Reply #4 - Posted 2008-10-09 22:32:22 »

Hi

Due to the 'fun' of loading native libs from an applet, most people end up doing their own loaders. LWJGL for example has an applet loader that downloads the native libs to a temporary directory. Then it sets the library path to include the temp dir and then loads the libs.

See this file.

HTH

Endolf

Offline beermann

Senior Newbie





« Reply #5 - Posted 2008-10-13 16:23:26 »

We do have our own loader, and we're doing exactly what LWJGL is doing when loading the native libraries.  As I mentioned, our applet runs fine in Java versions previous to 1.6 update 10, so it seems that we are doing this correctly.

Has anyone tried building an applet using jinput for keyboard input and running it under update 10?  If I get time I'll try the LWJGL code and see I can build an applet through that.  I don't have much experience with LWJGL so I don't really know what it will take to do so though.

Dale
Online Riven
« League of Dukes »

JGO Overlord


Medals: 605
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #6 - Posted 2008-10-13 22:09:51 »

Again: System.getSecurityManager() == null ?

Just print it to System.out

When your applet is signed, it should return null. However, when an AccessControlException is raised, I'm suspecting a SecurityManager is still installed - which would be a bug...

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline beermann

Senior Newbie





« Reply #7 - Posted 2008-10-14 22:04:06 »

System.out.println("security manager is null: " + (System.getSecurityManager() == null));

results in:

security manager is null: false

This is also the case with 1.6.0_07, _04, and _02 though.

Online Riven
« League of Dukes »

JGO Overlord


Medals: 605
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #8 - Posted 2008-10-14 23:16:14 »

Surprising... apparantly my assumption I had the last couple of years, is very wrong.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline beermann

Senior Newbie





« Reply #9 - Posted 2008-10-15 05:15:38 »

I was looking into LWJGL and from what I can tell they aren't using jinput for keyboard interaction but have their own keyboard poller. 

I'm kind of at a loss for what to do at this point, other than building the native libraries myself and trying to determine if they're getting called.  Is there no test that I can perform that will help me determine if anything is wrong from the Java side?
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Online Riven
« League of Dukes »

JGO Overlord


Medals: 605
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #10 - Posted 2008-10-15 07:38:55 »

LWJGL has its own input lib, which uses jinput under the hood

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline beermann

Senior Newbie





« Reply #11 - Posted 2008-10-15 17:20:28 »

I understand that LWJGL uses jinput.  In looking through their code, it seemed that they are using their own poller for the keyboard though. 

WindowsDisplay.doHandleMessage() calls handleKeyButton() which calls WindowsKeyboard.handleKey().  This stores the key state in their own buffer (key_down_buffer), which is used to populate the ByteBuffer that is passed in when WindowsKeyboard.poll() is called, and is also used in WindowsKeyboard.isKeyDown().

It seems that a LWJGLKeyboard is layered on top of this to provide a Controller interface to their own polling mechanism.  The pollDevice() call here calls into the WindowsKeyboard.poll() method mentioned above through WindowsDisplay.pollKeyboard().

I'm not describing this to try to prove that I'm right.  I admit completely that I could be mistaken.  This thread has taken a step in the negative direction.  I have an honest problem in production code that I'm trying to fix.  The terse comments are dead ends that are not providing any path to a solution.  The lack of support is convincing us that we will have to drop jinput if we can't resolve this soon.
Offline endolf

JGO Knight


Medals: 7
Projects: 1


Current project release date: sometime in 3003


« Reply #12 - Posted 2008-10-15 19:01:10 »

Hi

You're right about LWJGL not using JInput for keyboards, it doesn't use it for mice either IIRC, only game controllers (joysticks, gamepads etc). I've been looking around at this too, and whilst I can reproduce it, I can't explain it. I'm am still working on it though.

I'll not get any time until next week though, the downside of doing this in my spare time.

Cheers

Endolf

Offline endolf

JGO Knight


Medals: 7
Projects: 1


Current project release date: sometime in 3003


« Reply #13 - Posted 2008-10-15 19:04:16 »

Right, I just ran an applet that uses JME, which uses LWJGL, and that seemed to work, so I'm going to have to dig a bit deeper, it is definitely something going wrong that is not down to the JVM security manager type things.

Endolf

Offline beermann

Senior Newbie





« Reply #14 - Posted 2008-10-15 20:04:10 »

Thank you for the response.  If there's anything I can test on my end please let me know.  I am however running through Eclipse and don't have mingw or cygwin installed right now so it would take me some time to build the native libraries and get up to speed on that.

Regards,

Dale
Offline endolf

JGO Knight


Medals: 7
Projects: 1


Current project release date: sometime in 3003


« Reply #15 - Posted 2008-10-16 00:48:11 »

Hi

I'm fairly certain the natives are not even getting loaded, so I suspect that plastering the relevant jinput java code with debug is the way forward with this.

Cheers

Endolf

Offline endolf

JGO Knight


Medals: 7
Projects: 1


Current project release date: sometime in 3003


« Reply #16 - Posted 2008-11-14 23:47:13 »

Right,

Sorry for the delay. I've written a simple applet loader. It copies the jars to the a temporary place locally, then passes the property to jinput to tell it where to find the natives.

Check out a working demo here
and the source here and here.

All the jars (including the natives) are signed.

HTH

Endolf

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.

xsi3rr4x (48 views)
2014-04-15 18:08:23

BurntPizza (44 views)
2014-04-15 03:46:01

UprightPath (60 views)
2014-04-14 17:39:50

UprightPath (42 views)
2014-04-14 17:35:47

Porlus (58 views)
2014-04-14 15:48:38

tom_mai78101 (81 views)
2014-04-10 04:04:31

BurntPizza (140 views)
2014-04-08 23:06:04

tom_mai78101 (240 views)
2014-04-05 13:34:39

trollwarrior1 (200 views)
2014-04-04 12:06:45

CJLetsGame (207 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30
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!