Calling jar inside dll methods

Hello,
Can anyone give me a brief explanation on how to use the methods of a dll (made on c++) from java?
I would like to put the dll inside the jar/cab file along with the java classes.
best regards
Jonathan

Thank you, I checked the links which are were very instructional.
But I have one question remaining: How can I make reference to a dll inside my jar/cab file?
the line System.loadLibrary("xxx") load just dlls from the local machine?
best regards
Jonathan

Similar Messages

  • Call *.jar inside the trigger (MS SQL)

    Hi!
    I'm just looking around google and can't find any good news.. The problem is: how to call *.jar inside the trigger. Trigger is stored in M$ Server.
    Tnx, if any response! ;)

    What?

  • How to acess a value of variable(calling prg) inside the methods of a class

    Hi SapAll.
    i wrote a program where i need to acess a value of a variable inside the class method.
    for eg:
    CALL METHOD gcl_utl_app_log->display_log
        EXPORTING
          it_edidc = lt_edidc
          it_msg   = lt_msg.
    while debugging under the method 'DISPLAY_LOG' when i want to acess a value of a variable (calling program) i cont get that value but i can acess the value of the variable just before the CALL METHOD statement.
    so can any body help me in finding the solution for this.
    regards.
    Varma

    Hi jhings.
    i have delcared the variable in the main program like below
    main program
    PERFORM populate_z1edrmdseqnr01.
    FORM populate_z1edrmdseqnr01 .
    other code
    CALL FUNCTION 'NUMBER_GET_NEXT'
        EXPORTING
          nr_range_nr             = gv_number_nr
          object                  = lv_obj
        IMPORTING
          number                  = gv_nextno
    move gv_nextno to gv_seqno.
      EXPORT gv_seqno  to memory ID 'MEM1'.
    PERFORM FORM application_log.
    FORM application_log.
      CALL METHOD gcl_utl_app_log->display_log
        EXPORTING
          it_edidc = lt_edidc
          it_msg   = lt_msg.
    ENDFORM
    METHOD display_log.
    IMPORT gv_seqno from MEMORY ID 'MEM1'.
    *********when i save and check the above code iam getting the error as 'FiledGV_SEQNO is unknown,it is neither in one of specified tables not defined by 'DATA ' statement.**********
    regards.
    Varma

  • Calling JAR inside WAR

    Dear experts,
    I hope this is the right place to post such question. I have a web and desktop app developed using netbeans and to be built into a JAR(J) and WAR (W) file. I would like to know if it is possible for the (J) to call some other JAR (or .class) inside the (W)? Our ultimate goal is to share common classes between two apps, and hopefully no need to re-build the (J) when (W) is modified, or vice-versa. I hope my explaination is clear enough. Any comments and sugguestions is welcomed and appreciated, thanks.

    Remember that whatever servlet container (appserver) that you are using does not actually execute a WAR file but deploys its contents to a particular location.
    The contents can be JAR's, classes, images, whatever, but you need to specifiy in the classpath the JARs and class files that you wish to use.
    It is always a good idea though to rebuild the WAR file if you make a change to a JAR file that is contained in that WAR file. It should be rebuilt and redeployed.
    It is not good to manually change Jar files after the WAR is deployed.

  • Are DLL methods called as instance or static methods from Java ?

    Hi,
    I have only a small question.
    When I call a C++ DLL method from Java using JNI, do I instantiate it like an object method or is it called as a static method ?
    I am asking you this because I will use servlets (Java 1.2.2) to call a DLL. These servlets may run concurrently in any moment, and I pass some data to this DLL. I want to know if there is any possibility of this data becoming corrupt, because of one concurrent servlet rewriting the data another servlet has passed.
    Thanks and regards.

    The question is not specific enough.
    Methods in C/C++ can be qualified with the following forms:
    -global (C/C++)
    -static member(C++ class method)
    -instance member(C++ class method)
    Since you didn't provide your code I couldn't possible determine which of the above you are using, but presumably you know.
    On the other hand a java native method is either static or non-static depending on how you defined it in the class. Once again without the code there is no way to say and presumably you already know this.
    The context of the methods is the same context that a similar servlet method has. But naturally in C/C++ is is easy to circumvent the context - for example by using a global variable.
    Data in C/C++ can always become corrupt and in the vast (all?) cases it is because something is wrong in the C/C++ code. Like a pointer that is not initialized, or a pointer used after it is free'd. Or writing past the end of a buffer, or writing before the beginning of a buffer.

  • Calling the copy contructor inside a method.

    Hello everyone, Ive got a pretty annoying delima right now. Im trying to write a method that uses the copy contructor inside it and it is simply put, just not working.
    So how do you do this?
    Example I have a copy contructor for a Dll that makes a new copy of a Dll. Now I want to write a method that when its called on a Dll object and given a Dll parameter as input it makes a copy of the input and saves it into the calling Dll object.
    public void DLinkedList(DLinkedList theOriginal)  {
    code
    public void methodWithCopyContructorInside(DLinkedList list) {
    DLinkedList newList = new DLinkedList(list);
    ????????? This is what I would consider to work but since im here you can guess its not.
    Any suggestions, tips, comments would be most appreciated. Thank you.Message was edited by:
    venture

    Here is the code for the methods in question. I only didnt post all of it becuase it is alot of stuff and wasnt sure if anyone had the time and patience to read it. Sorry about that.
    This is the Copy constructor.
    public LinkedList( LinkedList theOriginal ) {
             if( theOriginal == this )
                 ;// do nothing
                  else {
                 // old contents is detached. Deleted by garbage collector.
                      makeEmpty();
                      // Thread the original list inserting all the values found
                      // into the copy. This code is short but inefficient.
                      theOriginal.toHeadNode();
                      while( theOriginal.toNextNode() ) {
                     int coe = theOriginal.getCurrentCoefficient();
              int exp = theOriginal.getCurrentExponent();
                          insertInAscendingList(coe, exp);       
                             //insertInAscendingList( value );
    This is the add method which is supposed to use the copy constructor inside it. Obvisouly from the name of my post you can conclude that this code is incorrect. But to me it seems correct. thus my dilemma.
    public void add(LinkedList b) {
      LinkedList a = new LinkedList(b);
    Here is the outputList method.
    public void outputList()
        toHeadNode();
        while( toNextNode() ) // returns false if back at head
            System.out.print( curr.item + " " );
        System.out.println();
    Now here is the driver program that uses these methods and constructors.
    public static void main(String[] args)
        LinkedList a,b;
        a = new LinkedList();
        b = new LinkedList(a);
        b.outputList();  //This works
        //Now if I call the copy constructor everything works fine. A copy is made and method outputList() will print everything out perfect. But!!, Now if I use the add() method
       b.add(a);
       b.outputList(); //This doesnt work
    im not sure what is being stored into b and outputList() returns nothing. A system.out.println() on b.add(a); returns LinkedList@d9f9c3 Message was edited by:
    venture

  • Calling DLL method from ABAP

    Hi there,
    Is there any way of IMPORTING return variables from DLL methods? The CALL METHOD of mydll only provides an option of EXPORTING variables from to a DLL method.
    For eg. consider the following method:
    Result = dll.FileOpen(hWnd,DocName,Flag)
    This method opens a popup box that displays a list of files and allows the user for selecting a file, the name of which is returned in the DocName variable.
    Any help will be appreciated.
    John

    Calling DLL using form 6i
    Regards,

  • Calling  dll method from oracle forms

    Hi,
    This is my first post in this forum. I don't know whether this is the right place to post this topic here.
    i wana call DLL method from the button click event of my form.
    I new to oracle development any help will be greatly appreciated.

    Calling DLL using form 6i
    Regards,

  • Is it possible to call the jar from dll

    Hi,
    I am new to JNI, so please sorry if my question seems trivial.
    I would like to know if is it possible the inverse task, to call java(jar) from dll.
    Thanks

    Thanks for reply,
    I searched in forum threads and found necessary disscussions on this topic, and tried to call java class from c++, but after
    CreateJavaVmProc JNI_CreateJavaVM =(CreateJavaVmProc)::GetProcAddress("C:\\Borland\\JBuilder2006\\jdk1.5\\jre\\bin\\client", "JNI_CreateJavaVM");I am having
    error C2664: 'GetProcAddress' : cannot convert parameter 1 from 'char [46]' to 'struct HINSTANCE__ *'
            Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
    Error executing cl.exe.error

  • Please help on how to use variables inside a method call

    Hello guys,
    How's it goin?
    Pardon me if you find my question silly, but I am relatively
    new in ActionScript 2.0 programming.
    I have here a simple problem. It seems I can't use a variable
    inside a method call of an object. Here's the code. Please note of
    the authParams string variable below.
    import AkamaiConnection;
    import mx.services.WebService;
    var GeneratedToken:String;
    var authParams:String;
    // Create a Web Service object
    var TokGenService:WebService = new WebService("
    http://webservice.asmx?wsdl");
    // Call the web service method
    var myToken:Object = TokGenService.GenerateToken();
    // Create an AkamaiConnection object
    var connection:AkamaiConnection = new AkamaiConnection();
    connection.addEventListener("onConnect", this);
    connection.addEventListener("onError", this);
    // If you get a result from the web service, save the result
    in a variable
    myToken.onResult = function(result)
    // If you get a result from the web service, save the result
    in a variable
    myToken.onResult = function(result)
    GeneratedToken = result;
    authParams = GeneratedToken +
    "&aifp=v001&slist=37414/test/Streaming/";
    //Call the Connect method of the AkamaiConnection class
    connection.connect("cp37414.edgefcs.net/ondemand",true,true,5,true,false,"443","rtmpt",
    authParams);
    But then, if I use a hard-coded string value in lieu of the
    variable, the method call works!
    connection.connect("cp37414.edgefcs.net/ondemand",true,true,5,true,false,"443","rtmpt",
    "testStringvalue");
    I don't know what I'm missing or what I'm doing wrong... Can
    somebody help me please? I am using a 30-day trial version of Adobe
    Flash CS3. Also, when I Trace output the variables, the values are
    there. It just that they can't be read or recognize inside the
    method call. Is this a ActionScript limitation?
    Thanks so much in advance!

    The result param is a returned, “Decoded ActionScript
    object version of the XML”. I am not exactly sure what that
    means but I have had issues of returned XML values and their
    datatype. When I did have these issues I had to cast or convert
    into the desired datatype. Try one of the following, assuming the
    problem is related to the code that you have bolded.
    GeneratedToken = result.toString();
    authParams = GeneratedToken +
    "&aifp=v001&slist=37414/test/Streaming/";
    Or
    GeneratedToken = String(result);
    authParams = GeneratedToken +
    "&aifp=v001&slist=37414/test/Streaming/";
    Or
    GeneratedToken = result.toString();
    authParams = String(GeneratedToken +
    "&aifp=v001&slist=37414/test/Streaming/");

  • How to call a standard BOR method in a program.

    Hi All,
    How to call a standard BOR method in a program. For example I have to call BOR method ISUSMORDER.Release in my program but don't know how to call.
    Also, plz tell me how to capture the Exceptions in case of BOR method.
    Plz help me out in this.
    Thanks,
    Mithilesh

    Would be easier (however not always possible), to determine the functionality of this method and call that in your program. I mean, normally this method calls a BAPI, or function module (or a transaction). Have a look at the coding inside of the method, and try and use this.

  • Starting new SAP LUW inside ABAP method

    I am calling a ABAP method and in that I want to start a new SAP LUW and do commit when leaving the method.
    The requirement is that all update function modules called inside the method should only be committed and no other prior update FMu2019s(before calling the method) should not be committed.
    Any idea if itu2019s possible to do that in ABAP OO and how do we do it.
    Thanks & Regards,
    Anand.

    HI ,
    Thanks for the quick replies. I tried using SET UPDATE TASK LOCAL but it was also committing all the prior update FM's before calling this method.
    I also tried using the RFM -    CALL FUNCTION 'ABC' IN BACKGROUND TASK   DESTINATION 'NONE' . and then
    COMMIT WORK AND WAIT.
    Now when i do commit work it commits all the previous update tasks also.
    And if i do not call COMMIT WORK right after the call to RFM, then the object that i am trying to create inside the RFM will not be committed.And then if i proceede some validations will fail as the objects were not created.
    Is there a way to commit immediately when the RFM is called without commiting the calling transaction from where this RFM is called.
    Any examples would be highly appreciated ..
    Regards,
    Anand.
    Edited by: Anand Ajitsaria on Feb 4, 2011 9:54 AM

  • Garbage collection of objects created inside a method

    I have method and inside the method I create new Objects I mean I instantiate objects using new and call some methods on these objects.
    once the method execution is completed and control goes to caller of the method will all the object created inside the method will be garbage collected ?
    here with code
               public List<StgAuditGeneral> getAudits(
              List<StgAuditGeneral>  audits= new ArrayList<StgAuditGeneral>();
                  for(Map<String, String> result :results ){
                   audits.add(new MapToObject<StgAuditGeneral>() {
                        @Override
                        public StgAuditGeneral getObject() {
                                             StgAuditGeneral  stg= new StgAuditGeneral();
                             return stg;
                   }.getObject());
              }in the above method I cam creating tons of objects wil they be garbage collected immediatedly after jvm leaves the method ?

    user11138293 wrote:
    I have method and inside the method I create new Objects I mean I instantiate objects using new and call some methods on these objects.
    once the method execution is completed and control goes to caller of the method will all the object created inside the method will be garbage collected ?If there are no reachable references, to those objects, then when the method ends, they become eligible for GC. If and when they are actually collected is something we can't know or control, and generally don't care about. The only guarantee is that everything that can be collected will be collected before an OutOfMemoryError is thrown. So from our perspective, once it's eligible for collection, it is effectively collected.
    If you pass references to those objects to something else that holds onto them after the method ends, then they are still reachable, and not eligible for collection.
    However, you almost never need to even think about whether something is eligible for GC or not. It works pretty intuitively.

  • Calling existing C++ dll from native code causes an ACCESS_VIOLATION

    Hi everyone,
    I'm having issues creating a Java app to call an existing c++ DLL. I've done extensive searching for a solution and found lots of goodies, but nothing to fix my problem yet.
    I've gone through the JNI tutorial and created my java class, used javah, and created my native code according to the tutorial.
    I'm new to dealing with DLLs so I'm not sure if there are some steps that I'm not taking.
    The issue comes when I run the program. I get an EXCEPTION_ACCESS_VIOLATION.
    the DLL I'm trying to call makes a call to a device on the USB port. I also have the source code and header files for the DLL but thought it would be easier to just have to deal with the already built DLL.
    After putting some print statements in the native function, the violation comes when I try to call the function in the external DLL. The DLL itself loads correctly (as far as I know).
    Here my native method that will load the external dll. I got the code to call the DLL method from:
    http://goff.nu/techarticles/development/cpp/calldll.html
    JNIEXPORT void JNICALL
    Java_OCPMControl_OCPMSetPixelCount (JNIEnv *env, jobject obj, jint pixelCount)
    //load the dll
    HINSTANCE ocpmSerialDLL = LoadLibrary("OCPMSerialDLL");
    /* get pointer to the function in the dll*/
    FARPROC myDLLFunction = GetProcAddress(HMODULE(ocpmSerialDLL), "OCPMSetPixelCount");
    /* Define the Function in the DLL for reuse. This is just prototyping
    * the dll's function. A mock of it. Use "stdcall" for maximum compatibility.
    typedef void (__stdcall * FUNC)(enum ePixelNum);
    FUNC MyFunction;
    MyFunction = FUNC(myDLLFunction);
    printf("Calling function\n");
    /* The actual call to the function contained in the dll */
    MyFunction(PIXEL256);
    /* Release the Dll */
    FreeLibrary(ocpmSerialDLL);
    When I run the program, I get the following error:
    An unexpected exception has been detected in native code outside the VM.
    Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x182
    91E6B
    Function=[Unknown.]
    Library=C:\sun\MyJava\ocpm\src\OCPMSerialDLL.dll
    NOTE: We are unable to locate the function name symbol for the error
    just occurred. Please refer to release documentation for possible
    reason and solutions.
    Current Java thread:
    at OCPMControl.OCPMSetPixelCount(Native Method)
    at OCPMControl.getData(OCPMControl.java:167)
    at OCPMService.main(OCPMService.java:46)
    Dynamic libraries:
    0x00400000 - 0x00406000 c:\sun\j2sdk1.4.2_03\bin\java.exe
    0x77F80000 - 0x77FFD000 C:\WINNT\system32\ntdll.dll
    0x7C2D0000 - 0x7C332000 C:\WINNT\system32\ADVAPI32.dll
    0x7C570000 - 0x7C628000 C:\WINNT\system32\KERNEL32.DLL
    0x77D30000 - 0x77DA1000 C:\WINNT\system32\RPCRT4.DLL
    0x78000000 - 0x78045000 C:\WINNT\system32\MSVCRT.dll
    0x08000000 - 0x08138000 c:\sun\j2sdk1.4.2_03\jre\bin\client\jvm.dll
    0x77E10000 - 0x77E75000 C:\WINNT\system32\USER32.dll
    0x77F40000 - 0x77F7E000 C:\WINNT\system32\GDI32.DLL
    0x77570000 - 0x775A0000 C:\WINNT\system32\WINMM.dll
    0x10000000 - 0x10007000 c:\sun\j2sdk1.4.2_03\jre\bin\hpi.dll
    0x007C0000 - 0x007CE000 c:\sun\j2sdk1.4.2_03\jre\bin\verify.dll
    0x007D0000 - 0x007E9000 c:\sun\j2sdk1.4.2_03\jre\bin\java.dll
    0x007F0000 - 0x007FD000 c:\sun\j2sdk1.4.2_03\jre\bin\zip.dll
    0x18270000 - 0x1827E000 C:\sun\MyJava\ocpm\src\OCPMNative.dll
    0x18290000 - 0x182AA000 C:\sun\MyJava\ocpm\src\OCPMSerialDLL.dll
    0x68120000 - 0x681A1000 C:\sun\MyJava\ocpm\src\instrsup.dll
    0x76B30000 - 0x76B6E000 C:\WINNT\system32\comdlg32.dll
    0x70A70000 - 0x70AD5000 C:\WINNT\system32\SHLWAPI.DLL
    0x71710000 - 0x71794000 C:\WINNT\system32\COMCTL32.DLL
    0x782F0000 - 0x78538000 C:\WINNT\system32\SHELL32.DLL
    0x77920000 - 0x77943000 C:\WINNT\system32\imagehlp.dll
    0x72A00000 - 0x72A2D000 C:\WINNT\system32\DBGHELP.dll
    0x690A0000 - 0x690AB000 C:\WINNT\system32\PSAPI.DLL
    Heap at VM Abort:
    Heap
    def new generation total 576K, used 140K [0x10010000, 0x100b0000, 0x104f0000)
    eden space 512K, 27% used [0x10010000, 0x10033368, 0x10090000)
    from space 64K, 0% used [0x10090000, 0x10090000, 0x100a0000)
    to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000)
    tenured generation total 1408K, used 0K [0x104f0000, 0x10650000, 0x14010000)
    the space 1408K, 0% used [0x104f0000, 0x104f0000, 0x104f0200, 0x10650000)
    compacting perm gen total 4096K, used 1012K [0x14010000, 0x14410000, 0x1801000
    0)
    the space 4096K, 24% used [0x14010000, 0x1410d1f0, 0x1410d200, 0x14410000)
    Local Time = Wed May 12 10:53:56 2004
    Elapsed Time = 10
    # The exception above was detected in native code outside the VM
    # Java VM: Java HotSpot(TM) Client VM (1.4.2_03-b02 mixed mode)
    # An error report file has been saved as hs_err_pid2120.log.
    # Please refer to the file for further information.
    Is there something else I have to do to tell the JVM that the external DLL call isn't an Access Violation?
    Would it be easier to use the source files instead?
    Thanks to anyone who can help me out here!
    Scott Campbell

    Thanks,
    The problem has been solved. I wasn't linking the dll properly to access the external DLL and thus, my native DLL was looking for methods that it didn't know how to find. which was easily solved by adding a few options when creating my native dll.
    Here is the link I found to solve the problem incase anyone else has issues like this. It is regarding implicit v.s. explicit linking to external DLLs in using visual C++.
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/_core_link_an_executable_to_a_dll.asp
    Scott.

  • Calling a c++ dll that contains a dialog.

    Hi,
    I have a c++ dll that contains a dialog. When I try to display the dialog (ShowDialog(SW_SHOW);) the dialog is popped up but the dialog window is frozen and do not display its controls. The Java application is call an intermediate dll create by JNI that is calling the c++ dll.
    Any Suggestions?
    Thanks in advance,
    Udi Raz

    It should be discernable (by looking at the C# code) whether the C DLL needs to be registered.
    If the DLL is serving COM objects it may need to be registered at a command-prompt with
    regsvr32 <your_DLL_File_path>
    If it's supplying .NET assemblies, I think it needs to be registered with
    regasm <your_DLL_File_path>
    Although I've written a few C DLLs, none were called from a C# DLL and I can't advise what subtle things to watch-out for in this scenario.
    Do you have a way to validate/exercise the C DLL's functionality? Is it possible to through-together a C# application (not a C# DLL) that successfully uses the C DLL?
    Luck/Cheers!
    Message Edited by tbd on 12-03-2008 02:36 AM
    "Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)

Maybe you are looking for

  • Double clicking on an Icon to display a frame....

    Hi! I have an icon whereby when double clicked on should display a frame. To display the icon, I have it as an ImageIcon placed on a label, which works fine. But my problem now is what kind of listener can I add to this label, if any that will cause

  • Error while reading the Long text Using READ_TEXT

    Hi friends, Right now I am working with Smartforms.While I am reading the Long text of the material using function module READ_TEXT  I am getting the following error if the text is not there. OUT_PURCH_PO ID GRUN language EN not found. I should not g

  • :( i cant see bluetooth in connection manager of ...

    i have nokia 6630 pc suit version 6.4.8 using unbranded pc windows 2000 sp4 usb bluetooth dongle adaptor in device manager it shows ISSC bluetooth device bluetooth device by IVT corporation when i open my connection manager, there is no bluetooth con

  • Unable to upgrade iTunes due to network error, wont read .msi file

    Hi I'm trying to upgrade iTunes on my windows PC and during the installation I get an error message saying "A network error occurred while attempting to read from the file C:\windows\installer\itunes.msi".  Also when I plug my ipad in to the PC to sy

  • How to report that itune billed me twice in one app

    I had to purchased app and istore billed me twice how should i do ?? i just checked the receipt it show like this Item Developer Type Unit Price Learn Spanish - MindSnacks, 50 Spanish Lessons Report a Problem MindSnacks In App Purchase $4.99 Learn Sp