How to use JNI to access Active X control ?

I need to access EFTPOS devices which provides Active X control inerface. Can I wrap Active X into dll so that I can use java native interface to access it ?
Thanks.

Hi Mahesh!
If nobody has answered by now...maybe you managed alone. Anyway here are some notes that might be useful:
The first thing to do is write your Java class with the native definitions. Now 'Build Project'.
Of course you shouldn't forget to have a line with
System.loadLibrary("your library name");Next you need to make the .h file. I think it's best to do this manually. In Netbeans you can add a line to the ant build script like:
<target name="-post-jar">
       <javah destdir="c" class="--your class full name--" classpath="${dist.jar}" />
    </target>but I don't know how to do this in Eclipse. Instead you will have to run javah manually like:
javah -classpath build -verbose  -d "c"   "--your class full name--"Do this from the main project directory.
Now create a separate C/C++ project with the name you used in the loadLibrary above, and make C files to implement the functionality you need (copy the function headers from the .h file). You should include the .h file and tell Eclipse where to find it. In Eclipse 3.4 there are workspace relative paths - and you can use those to add the include file.
The C project should be of type 'shared library'. On Windows it will produce a DLL.
Once you have your C project compiling, go back to the Java project, and edit the project class path. Under the 'source' tab expand your project source, and you will see a line for 'Native library location'. Select that, click the 'edit' button and add the path of the DLL (just the directory).
Now run or debug the Java program, and when you load the library, watch to make sure there is no exception.
How to debug: There are ways of debugging both the Java and C at the same time, but it's probably easiest just to put logging statements in the C (printf's) to see what's going on there.

Similar Messages

  • How to use the Java embedding activity in BPel

    hi all,
    How to use the java embedding activity in BPEL
    pls can u provide sample example

    1 Use [Oracle BPEL Process Manager Client Java API Reference|http://download-uk.oracle.com/docs/cd/B31017_01/integrate.1013/b28986/overview-summary.html] and especially [com.collaxa.cube.engine.ext|http://download-uk.oracle.com/docs/cd/B31017_01/integrate.1013/b28986/com/collaxa/cube/engine/ext/BaseBPELXExecLet.html]
    Instead of System.Out.println use addAuditTrailEntry(java.lang.String message)
    2. If you want to import a package write in code (Source View) of bpel process
    +<bpelx:exec import="package_name"/>+ for example +<bpelx:exec import="java.util.regex.Matcher"/>+
    example 1:
    String bodyAsString;
    StringBuffer myStringBuffer = new StringBuffer();
    try {
    bodyAsString = (String)getVariableData("BodyString");
    addAuditTrailEntry("bodyAsString1: "+ bodyAsString);
    Pattern pattern = Pattern.compile("goodDay");
    Matcher matcher= pattern.matcher(bodyAsString);
    while (matcher.find()) {   
    matcher.appendReplacement(myStringBuffer, "shitDay");
    matcher.appendTail(myStringBuffer);
    bodyAsString = myStringBuffer.toString();
    addAuditTrailEntry("bodyAsString2: "+ bodyAsString);
    } catch (Exception ex) {
    addAuditTrailEntry("Failed+bodyAsString",ex.getMessage());
    I put in code (Source View) the following
    <bpelx:exec import="java.util.regex.Matcher"/>
    <bpelx:exec import="java.util.regex.Pattern"/>
    example2:
    Object temp;
    try {
    temp = ((XMLElement)getVariableData("inputVariable","payload","/ns2:FiscalisMessage/ns2:Body")).getChildNodes().item(1);
    setVariableData("AdjReceipt",temp);
    addAuditTrailEntry("ok",temp.toString());
    catch (Exception ex) {
    addAuditTrailEntry("Failed :",ex);
    I put in code (Source View) the following
    <bpelx:exec import="oracle.xml.parser.v2.XMLElement"/>

  • How to use JAPI to Access Essbase 6.5

    Do anyone knows How to use JAPI to Access Essbase 6.5?
    I was told to install Enterprise Services 7.3.1.10.
    But when I test eds samples, I can connect Essbase but can not get data from Essbase.
    Need to change another Enterprise Services(I was told 7.3.1.10 is the latest version), or do some config in 7.3.1.10.
    Thanks a lot in advance

    Gee is correct. You will need to use EAS 7.x to add an analytic server. You will also have to do a few other tasks such as synch'ing security, etc.
    Further, as you are not accessing the exact same version of Essbase as your version of EDS, there is a property setting you will have to change to be successful. In eds\7.1.3\bin, open essbase.properties and modify the server.olap.direct setting to set it to false. What this setting does is forces EDS to use it's own private set of C API files and to use them for all calls to Essbase. Otherwise, EDS will attempt to use pure Java calls to the server. Unfortunately, the pure Java calls were implemented in an 'evolutionary' manner so every Essbase version got more calls until sometime in the System 9 timeframe. By the time 9.3 shipped (and maybe before, I would have to check), all calls the server are pure Java and that property setting is no longer available.
    Tim Tow
    Oracle ACE
    Applied OLAP, Inc

  • How to use Bind Variables in Essbase data control

    Hi,
    I am trying to use Bind Variables in MDX query while creating the Essbase Data Control. I have used the below query with the Bind Variable.. this query is working in Essbase admin console..but it is throwing error (*Invalid MDX Query)* while creating Essbase Datacontrol in JDeveloper.
    MDX Query : SELECT {[Measures].Msr_2} ON COLUMNS, [Time].Children ON ROWS FROM cube
    where ($name)
    Could any body suggest me on how to use bind variables with Essbase Data control.
    Thanks,
    Swathi

    Hello Swathi, can you please help me how you created Essbase DataControl? Also were you able to figure out this?
    Thanks, Praveen.

  • How to Use MRS Functionality at Activity Elements Level?

    When we use Multi Resource Scheduling for resources in PS, we specify "Resource planner process" as process variant at the network header and the Resource planner node.
    In the other hand, at the network operation level we are able to choose the same Process variant and the system displays the planner node to start planning; however we cannot do that when using activity elements because the icon to search the Resource planner is gray out.
    How can I use MRS functionality at activity elements level?
    I will appreciate your help.
    Ragards,
    Rafael

    Hi Rafael...
    A question were able to integrate elements activity to MRS?
    Thanks
    Damy Vidal

  • How to use jni with ervlets

    Hi
    i was trying to do some example with JNI. I can use JNI with standalone Java application but I just cannot figure out how I can use JNI with Servlet.
    Can some one show me a sample code using JNI with Servlets.
    thanks very much

    JNI is done in servlets that same way as other java.
    I suspect your problem is in the environment and perhaps how servlets work. It doesn't have anything to do with JNI itself.

  • How to use JNI with Servlets

    Hi
    i was trying to do some example with JNI. I can use JNI with standalone Java application but I just cannot figure out how I can use JNI with Servlet.
    Can some one show me a sample code using JNI with Servlets.
    thanks very much

    hi,
    I am also facing the same problem,
    when I am using JNI with stand alone application it works fine but when i tried to use it with a servlet It gives unsatisfied linker error
    stack: java.lang.UnsatisfiedLinkError: createSocket
         at RelayConnector.createSocket(Native Method)
         at RelayServlet.doGet(RelayServlet.java:70)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.iplanet.server.http.servlet.NSServletRunner.invokeServletService(NSServletRunner.java:891)
         at com.iplanet.server.http.servlet.NSServletRunner.Service(NSServletRunner.java:458)
    It seems i have to do some path settings in my iplenet web server.
    If some one have faced the problem i would be glad to know the solution for this, i am literally bugged up,....

  • How to use JNI in an Applet?

    Can a native method can be invoken in an Applet?If it can,which knowledge of Java should be used and how to use it?

    You could I suppose if yo sign the applet (which, if the user accepts it, will allow it to use features otherwise not available to an applet because of the secure sandbox). However, I am not sure how you would deploy the necessary native library since it must be available to the native OS loader (ie, a file on the client machine). If you are deploying the applets (see WebStart perhaps) you could do it.
    But generally it is a poor idea to try to use JNI in an Applet, and this is probably something that you would not want to use outside of an intranet environment.
    Chuck

  • How to use Javamail for accessing additional mailboxes -IMAP, Exchange 2010

    hi,
    I want to access a shared mailbox (NOT FOLDER) via Javamail API (1.4.5) using IMAP(s) with plain logon. The mailserver is a Exchange Server 2010.
    User: user1 ([email protected])
    pwd: xxxx
    shared mailbox: [email protected]
    Properties:
    mail.imaps.socketFactory.port = 993
    mail.imaps.starttls.enable = true
    mail.imaps.socketFactory.class = javax.net.ssl.SSLSocketFactory
    mail.imaps.socketFactory.fallback = false
    username = [email protected]
    password = xxxx
    I´ve managed to get access to the user1 - mailbox:
    Session session = Session.getInstance(properties, new ExchangeAuthenticator(username, password));
    session.setDebug(true);
    Store store = session.getStore("imaps");
    store.connect(imapHost, username, password);
    --> this works just fine! But now i want to access the additional mailbox by changing the login-String:
    [email protected]/shared_MB (user@domain/additional_MB)
    --> unfortunately I´m getting an "NO AUTHENTICATE" message:
    DEBUG: setDebug: JavaMail version 1.4.5
    DEBUG: getProvider() returning javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Sun Microsystems, Inc]
    DEBUG: mail.imap.fetchsize: 16384
    DEBUG: mail.imap.statuscachetimeout: 1000
    DEBUG: mail.imap.appendbuffersize: -1
    DEBUG: mail.imap.minidletime: 10
    DEBUG: trying to connect to host "host.domain.com", port 993, isSSL true
    * OK The Microsoft Exchange IMAP4 service is ready.
    A0 CAPABILITY
    * CAPABILITY IMAP4 IMAP4rev1 AUTH=NTLM AUTH=GSSAPI AUTH=PLAIN UIDPLUS CHILDREN IDLE NAMESPACE LITERAL+
    A0 OK CAPABILITY completed.
    DEBUG IMAP: AUTH: NTLM
    DEBUG IMAP: AUTH: GSSAPI
    DEBUG IMAP: AUTH: PLAIN
    DEBUG: protocolConnect login, host=host.domain.com, [email protected]/shared_MB, password=<non-null>
    DEBUG IMAP: AUTHENTICATE PLAIN command trace suppressed
    DEBUG IMAP: AUTHENTICATE PLAIN command result: A1 NO AUTHENTICATE failed.
    javax.mail.AuthenticationFailedException: AUTHENTICATE failed.
    I was able to get access with Thunderbird and also with the Exchange OWA-Client, so I think there is something missing in my code...
    or is it just impossible to get access to a different mailbox using javamail and plain-auth?
    Thank you in advance.

    Thanks bshannon, that was a great idea!
    I haven´t found an solution yet, but I have maybe identified the real problem:
    Here is some interessting Thunderbird - Logging stuff:
    744[7161040]: try to log in
    744[7161040]: IMAP auth: server caps 0x1187235, pref 0x1006, failed 0x0, avail caps 0x1004
    744[7161040]: (GSSAPI = 0x1000000, CRAM = 0x20000, NTLM = 0x100000, MSN = 0x200000, PLAIN = 0x1000, LOGIN = 0x2, old-style IMAP login = 0x4)auth external IMAP login = 0x20000000
    744[7161040]: trying auth method 0x1000
    744[7161040]: got new password
    744[7161040]: IMAP: trying auth method 0x1000
    744[7161040]: PLAIN auth
    744[7161040]: 7082000:xmail.domain.com:NA:SendData: 2 authenticate plain
    744[7161040]: ReadNextLine [stream=7ec9e88 nb=3 needmore=0]
    744[7161040]: 7082000:xmail.domain.com:NA:CreateNewLineFromSocket: +
    744[7161040]: 7082000:xmail.domain.com:NA:SendData: Logging suppressed for this command (it probably contained authentication information)
    744[7161040]: ReadNextLine [stream=7ec9e88 nb=27 needmore=0]
    744[7161040]: 7082000:xmail.domain.com:NA:CreateNewLineFromSocket: 2 NO AUTHENTICATE failed.
    744[7161040]: authlogin failed
    744[7161040]: marking auth method 0x1000 failed
    ---> okay, so PLAIN AUTH is failing.....
    744[7161040]: IMAP auth: server caps 0x1187235, pref 0x1006, failed 0x1000, avail caps 0x4
    744[7161040]: (GSSAPI = 0x1000000, CRAM = 0x20000, NTLM = 0x100000, MSN = 0x200000, PLAIN = 0x1000, LOGIN = 0x2, old-style IMAP login = 0x4)auth external IMAP login = 0x20000000
    744[7161040]: trying auth method 0x4
    744[7161040]: got new password
    744[7161040]: IMAP: trying auth method 0x4
    744[7161040]: old-style auth
    744[7161040]: 7082000:xmail.xmail.domain.com:NA:SendData: Logging suppressed for this command (it probably contained authentication information)
    744[7161040]: ReadNextLine [stream=7ec9e88 nb=23 needmore=0]
    744[7161040]: 7082000:xmail.domain.com:NA:CreateNewLineFromSocket: 4 OK LOGIN completed.
    744[7161040]: login succeeded
    --> okay, so Thunderbird is using "old-style IMAP login" and is successful.
    Unfortunately I have no idea what that actually means or how to use it in Javamail (is it even supported?). Any suggestions?

  • How to use Create input request Activity

     Hi,
     I want to get inputs from the users .
     I want to display a form were user can select a input from drop down list.
     That selected item i want to store it in a variable and use across the flow.
     How to do that using create input request or is there any other way to do that.

    You should be using "Input Request" to do what you are trying to do.
    Add "Create Input Request" to your workflow
    Configure the question you want the user to see in the Web Console. For example, "Select make of your dream car"
    Add "questions" to your input request. For the "drop-down" selection, chose to add new question of type "Select". This will bring up the dialog box that will allow you to configure the unique ID for your question, the free form text (label) and the list of selection choices to show in the drop-down.
    In the activities that follow "Create Input Request" you can retrieve the actual values that the user chose/typed by looking at the values in the [Workflow.Create Input Request.Task.Questions] table property. It has several columns: Id, Question, Value (that correspond to the fields you've configured)
    If you have Input request with several questions, you can use Select from Table activity to choose the specified question (by ID) that you want the value for. If you have only one question in the input request, you can get to the value (entered by the end user) by referencing this property [Workflow.Create Input Request.Task.Questions.First Row.Value]

  • How to use JNI?

    hi all,
    i know that pure java can't disable alt+tab,i must use JNI with C language. i have a pile of codes to disable the alt+tab in C but i do not know how to do it in JNI...can anyone help?thanks in advance...
    these are my codes in C:
    Private Declare Function SystemParametersInfo Lib "user32" _
    Alias "SystemParametersInfoA" (ByVal uAction As Long, _
    ByVal uParam As Long, lpvParam As Any, ByVal fuWinIni As Long) As Long
    Private Const SPI_SCREENSAVERRUNNING = 97
    Dim ret As Integer
    Dim pOld As Boolean
    Private Sub Form_Load()
    'The line below calls the function and passes
    'the constant and TRUE to fool Windows into thinking
    'the screensaver is running and FALSE to do the opposite...
    ret = SystemParametersInfo(SPI_SCREENSAVERRUNNING, True, pOld, 0)
    End Sub
    Private Sub Form_Unload(Cancel As Integer)
    'NOTE: THIS MUST BE SET TO FALSE WHEN
    'THE FORM OR APP CLOSES
    'If you do not set it to false, these keys will not work
    'with any app, or with anything in the Windows Environment...
    ret = SystemParametersInfo(SPI_SCREENSAVERRUNNING, False, pOld, 0)
    End Sub

    There really isn't a lot to using JNI.
    There are examples on Sun's website:
    http://developer.java.sun.com/developer/onlineTraining/Programming/JDCBook/jniexamp.html
    There is also a little more simple example at:
    http://www.inonit.com/cygwin/jni/helloWorld/java.html
    Basically, here are the steps:
    1) Create a simple java applet that will call your C/C++ code.
    For practise, I would just use the HelloWorld example from www.inonit.com:
    package example.jni;
    public class HelloWorld {
         private static native void writeHelloWorldToStdout();
         public static void main(String[] args) {
              writeHelloWorldToStdout();
    2) Name the file with the code above HelloWorld.java and compile it:
    javac HelloWorld.java
    3) Use javah to generate the C header file:
    javah example.jni.HelloWorld
    (You may need to cd to the parent directory of 'example', in this case)
    4) The above line should create a example_jni_HelloWorld.h header file.
    Use this header file in your C/C++ DLL. Make sure your C/C++ compile knows where to find jni.h. In my compiler, I added the following paths:
    C:\J2SDK1.4.1\INCLUDE\
    C:\J2SDK1.4.1\INCLUDE\WIN32
    5) The trickiest part about JNI is passing in and returning parameters.
    If you don't have to pass in or return any parameters, then you're almost done. Replace your C/C++ function protocol with the protocol in the header file you generated. Compile your DLL.
    6) Copy the DLL to a path that it will be found by your Java Applet. (If running on Windows, this would be your System32 or System directory.)
    7) I also had to edit my Path environment variable to include the Java Runtime bin directory. On my machine it was: C:\J2SDK1.4.1\jre\bin
    8) Try running your java applet:
    Java example.jni.HelloWorld
    Good Luck!

  • HT1414 how to use itune for iphone activation

    how to use itune for iphone activation

    Get the latest version of iTunes, your Apple ID and just connect the iPhone to your computer and iTunes will guide you through activation.

  • How to use jacob to access a com object with coldfusion7

    i want to use jacob to access a com objcet with coldfsuion7(i
    just want to do a test)
    how to do?
    Thank a lot!

    Flashcqxg wrote:
    > i want to use jacob to access a com objcet with
    coldfsuion7(i just want to do a test)
    > how to do?
    you don't. use createObject():
    mailer=createObject("COM","CDONTS.NewMail");
    http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=cfobject_08.html

  • How to use rescuecd to access NAS200 RAID drives

    I have been lurking trying to figure out how to access my NAS200 drives after a power supply failure and of course I have no backups, relying on the RAID to create my two copies.  (Lesson learned)
    I have a NAS200, with two Western Digital 1TB Green hard drives.  They are configured in a RAID 1 mirror and they are in a journaled file system
    So from what I've been reading, I believe they are in XFS. and I can use the rescuecd iso to access the drive directly to copy them off onto another drive.
    I am using Windows XP SP3.   The computer system is 8 years old - a Dell Pentium 4 Dimension system with 4GB of memory.   I do have Ubuntu, but I have no idea how to use Linux, and definitely not the command line that the rescuesystemcd drops me into.
    I've taken one of the drives and installed it in an external USB drive and plugged it in the system.
    In Windows XP SP3, I can see the drive on my virtual file manager and I can see the three partitions, one main data partition, the configuration partition and the swap partition, but of course it's not the right file system. and it's not ext2/ext3  so Ext2IFS will not work for me from what I've read.
    In ubuntu 11.10, when I've plugged in the external drive, I have no idea how to access the drive.   I suspect I have to mount it, but I have no idea how to do it or even where to begin looking for it to access it. 
    And of course in the CLI using the systemrescuecd, I am completely lost there:   The last CLI I used was MS-DOS from over 15-18 years ago.   I can ls (MS-DOS dir) and cd to navigate the folders of the file system and I believe cp is copy? and if I was using the Ubuntu CLI, I have to sudo everything I believe.
    So after this long post, what am I asking for?
     - How do I mount the external drive in either Ubuntu or the system rescue CD iso.
     - Can I mount a second external drive with a NTFS file system in Ubuntu or the system rescue CD?
     - I would prefer to do it in Ubuntu or some other graphical method so that I could just drag and drop from one disk onto another or failing that using the commandline, what command would copy the entire drive's file system from one to another?
    Thanx

    Are you able to access the web interface of NAS200 using its IP address? If, 'yes' then unplug both the hard drives? Reset NAS200, reconfigure it and connect the drives again. See if that helps.

  • How to use Network utility, or activity monitor

    Hi There,
    Can anyone point me in the direction of something that can tell me more about how to use these programs? Thanks.
    DMWard

    Click here and here for information.
    (33707)

Maybe you are looking for

  • LDAP SSO to database in XI3.1

    Hi  All, We are using XI3.1 and trying to find a solution for configuring LDAP single sign on to database and have not been able to find any material on that matter. Is it possible to configure LDAP SSO to database (Oracle 11) natively? Or is there a

  • HT204053 my iphone showing offline all the time in find my iphone app.?

    I lost my iphone few days befor then i buy new iPhone 32 GB, I try to track my iphone throug Find my iPhone app. but its can't find the location.

  • Protect - endprotect in Smartform

    hi what is the similar statement for protect-endprotect in smartforms please help me out. regards padma

  • Purchase requsition to purchase order

    hi all,   I want to make a compulsory purchase requsition field in po for a particular document type only ,not the other document type for the same user?     How we can do this? Any help Regards sri

  • Dynamic Variable

    Hi, I wrote a script logic like this for Dynamic varibales. {Code} *XDIM_MEMBERSET TIME =2009.FEB,2009.MAR *XDIM_MEMBERSET  C_ACCT= 12110600 *XDIM_MEMBERSET C_CATEGORY = C_100 *WHEN C_ACCT *IS "12110600" *REC(EXPRESSION=%VALUE%/1.5098,RPTCURRENCY="EU