Using Fantom USB Driver from JNI
        Posted  
        
            by 
                Starky
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Starky
        
        
        
        Published on 2011-11-27T01:39:02Z
        Indexed on 
            2011/11/27
            1:50 UTC
        
        
        Read the original article
        Hit count: 536
        
I'm having some difficulty with JNI. I'm using JNI to call some Java methods from a C++ program. This implementation of JNI is working fine.
The goal of the Java program is to send commands over USB to a LEGO robot using LEJOS. This works fine when running the Java program by itself but for some reason when I call the methods from C++ the robot cannot be detected.
My only lead so far is that there may be some problem using the Fantom USB driver from a JNI call. This is the driver that's used for the USB connection to the robot. I've had a quick look at the code for the driver and it looks like it makes use of JNI too.
So I guess I'm asking the following things:
- What differences could there be between calling code from JNI and executing it through command prompt with the 'java classname args' method which could cause this problem?
 - Could it be that there is some problem with me using JNI in C++ when the driver that's being used uses JNI as well?
 
I won't post any code just now as I don't think it's really relevant but if anyone thinks that they need to see it then I can add it.
© Stack Overflow or respective owner