JAVA NATIVE ACCESS

hi
It would be helpfull for me if anybody give good reference/ link related JAVA NATIVE ACCESS
i have tried through google and sun search but most of all are java native Interface...
so please
thanks in advance

Hello guys,
I have a problem in JNA to create interface method because i must search functions in DLL which have many structures as argument. So i find JNA is difficult but less than JNI.
I would like to give you my specification file and traduce this fonction in the interface of JNA. Please help me !!!!
Here is these C functions :
typedef disco_err (WINAPIV* win_disco_init)(disco_init_conf_t* conf);
typedef enum {
DISCO_ERR_NONE = 0, //!< No error
DISCO_ERR_IO = -1, //!< IO error
DISCO_ERR_DB = -2, //!< Database error
DISCO_ERR_MEM = -3, //!< Memory allocation error
DISCO_ERR_PAR = -4, //!< Invalid parameters
DISCO_ERR_ND = -5, //!< Max number of opened descriptors is
reached
DISCO_ERR_NS = -6, //!< Service not supported
DISCO_ERR_ID = -7, //!< Bad id
DISCO_ERR_FF = -8, //!< Bad file format
DISCO_ERR_EOF = -9, //!< End of file
DISCO_ERR_NOE = -10, //!< No such entity
DISCO_ERR_INT = -11, //!< Database build interrupted
DISCO_ERR_ACCESS = -12, //!< Access denied
DISCO_ERR_EMPTY = -13, //!< Empty information
DISCO_ERR_NO_MORE_RESPONDING_IPOD = -14, //!<no more iPod
DISCO_ERR_OTHER = -30, //!< Other
}disco_err;
typedef struct {
disco_uart_iap_init iap_via_uart;//! Unused
int priority; //!< Priority level of Disco threads
disco_spec_strs_t strs; //!< Special strings configuration
}disco_init_conf_t;
typedef struct {
const char* empty; //!< String for undefined lists elements
const char* root; //!< Name for virtual 'Root' directories
}disco_spec_strs_t;
So it's a real crazy mapping between C and Java. It's too dificult for me. i hope there will be a professional of mapping ? Give me the solution please because i have 20 days to design the modul of my java application.
thanks in advance,
Nicolas.

Similar Messages

  • JAVA NATIVE ACESS

    HI,
    I have a big problem with Java Native Access when call a function in dll file.
    First, I have files xxx.dll,xxx.h (written by my partner) and document for functions.
    Second, I am using JNA (java native access) to call the functions.
    But, it has some functions that function's result is pass over memory of window.
    In document description, it has tow constant: WM_USER = 0x0400, WM_USER_ENV = (WM_USER + 0)
    I have just learn, so i don't know about that.
    So, my problem is " i don't know how to get result of function that passed over to memory window )
    This is my header file: “MFSIOCTL.h”
    // Command
    #define     CMD_VERSION               'V'
    #define     CMD_SENSOR               'S'
    #define     CMD_FLICKER               'L'
    #define CMD_GETSTATUS          'A'
    #define     DEST_1                    '1'          //front door / Card Reader Flicker Lamp
    #define     DEST_2                    '2'          //UPPER FRAME IN POSITION(CDM) / Printer Lamp
    #define     DEST_3                    '3'          //Receipt Exit Sensor / Cheque Lamp
    #define     DEST_4                    '4'          //Cheque Door Sensor / A4 or Cash Lamp
    #define     DEST_5                    '5'          //Bill Hopper Sensor - 2006/06/20 added
    #define DEST_ALL               '0'          //Get all Status
    //switch status or FLicker Lamp on/off
    #define OPEN                    '0'          //Flicker Off
    #define     CLOSE                    '1'          //Flicker On
    //added at 2004/09/17
    #define WM_MFS_IO_OFFSET                    (WM_USER+0x900)
    #define     WM_MFS_IO_CHG_EVT                    (WM_MFS_IO_OFFSET + 0)
    extern "C" __declspec(dllexport) BOOL __stdcall MFSIO_Open(HWND hWnd,BYTE comport);
    extern "C" __declspec(dllexport) BOOL __stdcall MFSIO_Close(void);
    extern "C" __declspec(dllexport) BOOL __stdcall MFSIO_GetVersion(LPSTR lpFWVer,LPSTR lpDLLVer);
    extern "C" __declspec(dllexport) BOOL __stdcall MFSIO_LED(BYTE LEDNum,BYTE OnOff);
    extern "C" __declspec(dllexport) BYTE __stdcall MFSIO_GetStatus(void);
    And this is window message define:
    --- Definition of Window Message
    : Message is defined in “MFSIOCTL.h” as bellows.
    #define WM_MFS_IO_OFFSET (WM_USER+0x900)
    #define WM_MFS_IO_CHG_EVT (WM_MFSS_IO_OFFSET + 0)
    MESSAGE WPARAM(Indicator ofDoor or Media) LPARAM(Status of Door or Media)
    WM_MFSS_IO_CHG_EVT DEST_1 or OPEN or CLOSE
    DEST_2 or
    DEST_3 or
    DEST_4
    Refer to “MFSIOCTL.h”
    In functions, i don't know that they relative with parameters as "WM_MSF_IO_OFFSET, WM_MFS_IO_CHG_EVT'' and parameters use for what?
    How to get value of window message?
    Please help me. Thank you.
    Edited by: QuocTan on Sep 8, 2010 9:31 PM
    Edited by: QuocTan on Sep 8, 2010 9:34 PM

    But, it has some functions that function's result is pass over memory of window.I have no idea what that means. Please try again in standard English.
    In document description, it has two constant: WM_USER = 0x0400, WM_USER_ENV = (WM_USER + 0)
    These are Windows constants. I don't understand the relevance.
    So, my problem is " i don't know how to get result of function that passed over to memory window)*My* problem is that this is about the 4th time I've read this statement and it doesn't make any sense. What is a 'memory window'? What is 'memory of window'?
    #define WM_MFS_IO_OFFSET                    (WM_USER+0x900)
    #define     WM_MFS_IO_CHG_EVT                    (WM_MFS_IO_OFFSET + 0)If these lines are the problem, they have nothing whatsoever to do with JNI or this forum.
    In functions, i don't know that they relative with parameters as "WM_MSF_IO_OFFSET, WM_MFS_IO_CHG_EVT'' and parameters use for what?Eh?
    How to get value of window message?What?
    Please help me.I cannot help either of you until you take the trouble to express yourselves clearly in standard English. Your problem doesn't appear to have anything to do with JNI or JNA. More likely it is an elementary Windows API programming problem, which is irrelevant to this forum and this site.

  • Not able to start the Sun Java System Access Manager 7 Console

    Hi All,
    I have successfully installed the Sun Java System Portal Server 7 on RHEL 4.0.The problem I am facing is not able to start the Sun Java System Access Manager 7 Console while accessing the URL: http://fqdn:8080/amconsole
    As soon as I try to access this URL it gives me following Excepiton:::::::
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    com.iplanet.jato.NavigationException: Exception encountered during forward
    Root cause = [java.lang.NullPointerException]
         com.iplanet.jato.view.ViewBeanBase.forward(ViewBeanBase.java:386)
         com.iplanet.jato.view.ViewBeanBase.forwardTo(ViewBeanBase.java:267)
         com.iplanet.am.console.base.ConsoleServletBase.onUncaughtException(ConsoleServletBase.java:338)
         com.iplanet.jato.ApplicationServletBase.fireUncaughtException(ApplicationServletBase.java:1023)
         com.iplanet.jato.ApplicationServletBase.processRequest(ApplicationServletBase.java:469)
         com.iplanet.jato.ApplicationServletBase.doPost(ApplicationServletBase.java:324)
         com.iplanet.jato.ApplicationServletBase.doGet(ApplicationServletBase.java:294)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:747)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
         sun.reflect.GeneratedMethodAccessor106.invoke(Unknown Source)
         sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         java.lang.reflect.Method.invoke(Method.java:585)
         org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249)
         java.security.AccessController.doPrivileged(Native Method)
         javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
         org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282)
         org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165)
    If anyone have any idea about the cause of this error,please let me know.All suggestions are welcome .
    Thanx and Regards,
    Chirag.

    Hi All,
    I am having exactly the same problem with the same stack trace. Has anybody have an idea how to fix this?
    I have downloaded the Java Identity Management Suite.(java_es-5-identsuite-ga-windows-x86.zip) The first time installation was fine and I was able to bring the Access Manager console. I was able to create users groups etc.
    However, when I uninstalled and installed it again, I got exactly the same error described in the thread. Running "amserver start" and "amserver restart" did not help. I did the installation one more time
    but again I got the same error.
    Thanks for the help.
    celikkan

  • Integrating WebSphere Portal Server with Sun Java System Access Manager

    Hi All,
    Is it possible to Integrate WebSphere Portal Server with Sun java System Access Manager?. If so plz send me any doc or web site link for the same.
    Thanks in Advance
    Rgds,
    Lessly J

    Rushi-Reliance wrote:
    Kindly let us know how to proceed further as we are waiiting some reply from your team.As I already advised in your previous posting (http://forums.sun.com/thread.jspa?threadID=5359095), you are best off re-installing solaris from scratch and installing Communication Suite 6 update 1 if you cannot get Access Manager 7.1 configured.
    Regards
    Shane.

  • How to use the java native api

    i am new to the java native api, can anyone tell me how to use it in order for me to use the c++ file in the java file?please explain it if possible, thanks

    Try this out to learn the basics :
    http://java.sun.com/docs/books/tutorial/native1.1/index.html
    You can't go wrong from there.

  • Linking Java to Access Database tables

    Hello,
    I need use JCreator to link Java to Access Database tables.
    Could any one tell me what kind of drivers I need use?
    Also, where could I find the examples of linking Java to Access Database tables?
    Thank you,
    Daniel

    Thanks.
    I have read the tutorial and downloaded the sample code from the web http://java.sun.com/docs/books/tutorial/jdbc/
    In the CreateCoffee.java programming, I made the following changes:
         //     String url = "jdbc:mySubprotocol:myDataSource";
              String url = "jdbc:odbc:DB1";
    DB1 is an Access Database file located in the same folder as CreateCoffee.java.
    //Class.forName("myDriver.ClassName");
                   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Every time when I run the CreateCoffee.java programming, it shows the following running error:
    SQLException:[Microsoft][ODBC Driver Manager]
    Data source name not found and no default driver specified.
    Could any one have any suggestions for solving the above problem?
    Thank you,
    Daniel

  • Problem with Java Native Type after Migration from 7.0 to 7.1

    Hi,
    after Migration from Netweaver 7.0 to Netweaver 7.1 I get following error:
    FileDownload 'FileDownload.data': Context attribute 'PrintSelectedView.PdfToDownload.resourceInputStream' has the Java native type 'com.sap.tc.webdynpro.progmodel.api.IWDInputStream' and cannot be bound to this property. Hint: Remove the binding or bind a context element matching the property's type.     
    What have I done wrong?
    How could I fix this problem?
    Best regards,
    Peter

    Hi,
    thanks, this solved the problem.
    Thank you.
    Best regards,
    Peter

  • JAVA NATIVE TYPES

    Hi everyone,
    Can anyone let me know what are java native types and its purpose?
    Regards,
    Subrat

    Hi Subrat,
    I assume you are asking about the Java Native Types option while creating context attribute. Java native types give you the ability to assign the Java Classes as types for your context attributes. that means you can create your context attributes based on Java Classes. They are useful when you have to store some data in the context attributes for which no direct type is given by Web Dynpro.
    Regards,
    Ajay

  • Can ABAP program and a Java apps access the same DB table?

    If an ABAP program and a Java apps access the same DB table, how does the Enqueue services from ABAP and Java communicate with each other to ensure locking consistency (if they even communicate with each otehr at all)?
    Or there wont be such situation because there are separate schema for ABAP stack and Java stack?
    Your help is greatly appreciated.

    Hello!
    A while ago I was a subject to criticism too for not granting points to helpfull answers. I appeared to be ungratefull, but I'm actually not (I guess the same goes for Vincent). I absolutely agree that good people who provide helpfull answers deserve (at least) points, but I didn't quite get the whole idea with points untill I was explicitly warned. I took some time to correct this and I granted points for all my past questions, generously, with "interest rates" for waiting.
    My point is:
    The pointing system is good, but unintuitive and not documented. I suggested this at that time, and I see that nothing has changed since. I see also that I'm not the only one who has experienced missunderstandings.
    I repeat the message to SDN people: Please provide some info on pointing system! A few sentences behind a "What's this?" link would do. It's not such a hard work.
    Thanks!
    Kind regards,
    Igor Barbaric

  • Java.exe Access Violation Error(URGENT)

    Hi all,
    I have created a application for my company. This application requires a user to login into the site by giving his userid/pwd. Once the person logs into the site, there is this error "Java.exe Access Violation Error" which pops up and terminates the Web Server.
    My Login page is a HTML page which inturns calls a Jsp which authenticates the user.Once the authentication is completed, the user id is put into the session so i can check for the existence of user session on each subsequent page. After the user successfully logs in, the error pops up.
    Please get back to me incase u have ever encountered this error and what might be the solution.
    I am using Tomcat Webserver 3.2.3, Sql Server 7.0 as the Database Server, JDK1.3 .
    Regards,
    Yatin

    As far as i remember i faced this problem when the memory of my pc was broken. So it may not be a problem of java or html code.

  • Execution of Java Native Process slow in Mac OS X

    Hi,
    I'm having some performance issues when executing an java native process on Mac OS X. I am developping an application in AIR that searches for people in the ldap of our organisation. It has to be usable both on Mac as on Windows. When I execute my app on windows, the search process takes about 2-3 seconds. However, when I try to execute it on mac, the search process takes about 6-8 seconds. This is a bit to long to make it usable.
    Has anybody encountered this problem as well and does anyone know what the problem can be?
    Thanks in advance
    Ronald Kamp
    Junior Flex/Java/LiveCycle Consultant at iDA MediaFoundry

    Hi Ronald,
    Have you tried benchmarking your java process without the inclusion of AIR?  If so, did you find a difference which points to AIR being a culprit for the performance hit?
    I'd be very interested in trying this out.  If you could provide me with a sample project that illustrates the slow down on Mac, I'll take a look right away.  Please feel free to contact me via private message on the forum or at [email protected] if you'd like to take this offline.
    Thanks,
    Chris

  • HELP : "LINUX BASH COMMANDS" Java Native Interface

    how can i create a program using Java Native Interface that could run or recognize LINUX BASH COMMANDS

    Runtime.getRuntime().exec(<command>); But read this:
    http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html

  • Can java software access media on the phone?

    Hello
    Can homemade java software access mp3-files, images, sms, phone book etc. on a mobile phone?

    FileConnection API, PIM API,...
    have you read some docs on J2ME ?

  • How to access android resource in java native extension....??

    hi..
    i want access android resource..
    for example, res/menu/menu.xml, res/values/strings.xml ... etc...
    - R.java -
    /* AUTO-GENERATED FILE.  DO NOT MODIFY.
    * This class was automatically generated by the
    * aapt tool from the resource data it found.  It
    * should not be modified by hand.
    package com.flash.extension.nativelib;
    public final class R {
        public static final class attr {
        public static final class drawable {
            public static final int icon=0x7f020000;
            public static final int notification_icon=0x7f020001;
        public static final class layout {
            public static final int main=0x7f030000;
        public static final class string {
            public static final int extension_app_name=0x7f040001;    -> "hi extension"
            public static final int extension_hello=0x7f040000;
    so i used getResourceId("string.extension_app_name");
    but it's not work.. throw NotFoundException error..
    so i used context.getString(R.string.extension_app_name);
    it's work, but return incorrect value.. -> return value is "0.0.0".. it's versionName in actionScript Client Project..
    why can't access android resource in native extension?
    how to get android resource in java natvie extension..??
    Is there anyone who has a sample source??
    help.. me.. please..

    Hello,
    I am facing the same issue with the native extension i am using follwing code to get the resource id
             Intent inte = new Intent(context.getActivity().getApplicationContext(),SecondActivity.class);
              inte.putExtra("layout",context.getResourceId("layout.secondactivity"));
              context.getActivity().startActivity(inte);
    i am getting this exception "android.content.res.Resources$NotFoundException:layout.secondactivity"
    I have included activity in the native manifest file as well as flex's manifest file for android.
    please help me with this or an example will be great thanks.

  • Java Native Interface Exception Access Violation

    Ok i have two programs One that works and one that dosn't
    the one that works is a javaMethod that calls a C method. the C method then uses a callsback on a java method that returns an array of integers. that works fine
    the Second program uses the same c side code and the same Java Methods from the original are implemented into a program i have that runs a Jframe. anyways when i run this program the Native side does all of its tasks but when its done it crashes Evrything
    here is the Native Code
    #include <jni.h>
    #include "MyNativeInterface.h"
    #include <stdio.h>
    JNIEXPORT void JNICALL
    Java_MyNativeInterface_sayHello(JNIEnv *env, jobject obj)
    printf("Hello world!\n");
    return;
    JNIEXPORT void JNICALL
    Java_MyNativeInterface_nativeMethod(JNIEnv *env, jobject obj)
    jintArray arr;
         jint len;
         int *carr;
         int i;
    jclass cls = (*env)->GetObjectClass(env, obj);
    jmethodID mid =
    (*env)->GetMethodID(env, cls, "callback", "()[I");
    if (mid == NULL) {
    return; /* method not found */
    printf("In C\n");
    arr = (*env)->CallObjectMethod(env, obj, mid);
         len = (*env)->GetArrayLength(env,arr);
         printf("Array Length = %d\n",len);
         carr = (int*)malloc(len);
         (*env)->GetIntArrayRegion(env,arr,0,len,(jint*)carr);
         for (i=0;i<len;i++)
    printf("Array position %d is %d \n",i,carr);
    and here is the java class that deals with the native side
    import java.util.*;
    public class MyNativeInterface extends Object {
    private TextAreaDemo gui ;
    public MyNativeInterface (TextAreaDemo guiRecieved)
    gui = guiRecieved;
    static {
    System.loadLibrary("hello");
    public boolean sendLocoMessage ( byte [] bytesToSend )
    try {
    System.out.println("number Of Tokens ="+bytesToSend [0]);
    } catch (Exception e) {
    System.out.println("didn't even get inside2 ok ");
    return true;
    public void receiveLocoMessage ( byte [] bytesToSend ){
    gui.AddMessage ("WOOOOO HOOOOOO");
    public native static void sayHello ();
    public native void nativeMethod();
    private int [] callback() {
    int cools [] = new int [32] ;
    int i = 0 ;
    for (i=0;i<32;i++)
    cools [i] = i;
    //System.out.println("In Java");
    return cools;
    the Say Hello Method works just fine
    and the array for the C side prints out just fine
    then evrything crashes with the following message
    An unexpected exception has been detected in native code outside the VM.
    Unexpected Signal : EXCEPTION_ACCESS_VIOLATION occurred at PC=0x6D3276E4
    Function=ZIP_Open+0x107
    Library=c:\j2sdk1.4.0_01\jre\bin\zip.dll
    and a whole BUNCH of current java thread stuff and a list of dynamic libraries.
    anyways thanks

    Your C code asks for the length of the array, then
    allocates that many BYTES using malloc. This looks
    bogus to me.I agree.
    Maybe something like this would be better:
    carr = (int*)malloc(len * sizeof jint);

Maybe you are looking for

  • Error while Saving Service Sales order.

    Hi.. Please help me for resolving below error.. While saving service sales order error is coming as- Invalid account assignment category... Detailed Error- "Assign components to a/c assignment category & Account Assigmnet Category not defined. In cus

  • SAP transaction iView not executing the transaction directly

    Hello guys, having a little problem with SAP transaction iView I created - specified system, where the transaction is delpoyed. When I click on the page containing the iView, R/3 logon page comes up instead of the transaction itself being executed. T

  • Getting wife a new iphone..backup questions

    Not too good in using itunes.  My wife has an iphone and my limit to itunes is putting some songs on my ipod.  I want to surprise my wife with a new iphone this week and before I get her a new one I want to make sure I save all of her content and mos

  • What does Music iTunes Album Artwork Cache do?

    What does this Cache folder hold, and what is it used for? The reason I ask is I get a very juddery scroll when perusing my music by album cover until all the albums have loaded into memory and then it goes smooth. If I could increase the cache size

  • Losing Reader Extension Rights After Saving

    Hi, I have a form I have had extensions enabled. When a user opens the doc with Reader 7 for a start it works fine, they can fill in the fields and save the form. However, when they come back later to make more changes to the form (after saving and c