How to call the DLL functions through Java

Hello,
I have already got a VC++ generated DLL. It has serveral functionalities. I need to call those functions from my Java Application. Now i know that it can be possible only through writing Java JNI Interfaces.
Everywhere i only see they give an example where in they tell to create an DLL. Now how do i will call if an DLL is ready and exists.
If anyone can give an example then it will be very helpful to me. Please mail me at [email protected] .
Thank you
vvpatro

You can't call functions in an arbitary DLL form Java. You need to use JNI to produce a 'wrapper' DLL that maps Java methods to the methods in the target DLL. The purpose of the wrapper is to allow type conversion between Java types and C/C++ types. The complexity of this task depends largely on the types used in th target DLL. If the targer DLL uses only primitive types such as char, byte, int, long, string, the translation is simple and the wrapper DLL will be 'thin'. If however, the target DLL passes arrays and objects, or employs callbacks, these more work to do, and the wrapper will be correspondingly 'thicker'.
Hope this helps.

Similar Messages

  • How can i call a c++ function through java

    Hi,
    dose anyone knows how to call a C++ function in java?
    Thanks.

    see JNI...
    basically declare a native method in your java class, then run javah on the class thus generating a *.h file. Then implement the c/c++ function. Compile the c/c++ part as a shared library, and make sure its accessible from your LD_LIBRARY_PATH env variable.
    Go through the steps in the JNI docs, and things shoulde be fine... hopefully ;)

  • How to call the DLL writing in Vb6.0 from testsatnd?

    Hi,
    I want to call a dll writting in VB6.0 from teststand. But as i see from the "Step Setting" in teststand, only the C/C++ Dll can be selected in the "adapter" type. I try to use this one as my adapter to call my VB6.0 dll, in result, there is no function can be seen in the "function" tab in teststand.Anyone know how to call the DLL writing in Vb6.0?
    Solved!
    Go to Solution.

    Hi Ivan,
    Just to be sure that your DLL is not wrong
    you have check if all functions are well and present.
    There is  tool called "Dependency Walker"   You can download it at http://dependencywalker.com/ .
    With it you can look "inside" your dll
    If you will see your functions there, you will see them (in my case !!always!!) in TestStand, too.
    Hope this helps 
    Greetings
    Juergen
    =s=i=g=n=a=t=u=r=e= Click on the Star and see what happens :-) =s=i=g=n=a=t=u=r=e=

  • How to clear the DOS screen through java program

    how to clear the DOS screen through java program

    Just some Friday fun. Use the telnet program that comes with Windows and supports VT escape sequences.
    import java.io.*;
    import java.net.*;
    public class AutoTelnet {
         private static Socket s;
         public static void main(String[] args) throws Exception {
              Thread t = new Thread() {
                   @Override public void run() {
                        try {
                             s = new ServerSocket(5555).accept();
                        } catch (IOException ex) {
                             ex.printStackTrace();
              t.start();
              Process p = new ProcessBuilder("cmd", "/C", "start", "telnet", "127.0.0.1", "5555").redirectErrorStream(true).start();
              t.join();
              PrintStream ps = new PrintStream(s.getOutputStream());
              ps.println("Screen will be cleared in 5 seconds");
              ps.println("5");
              Thread.sleep(1000);
              ps.println("4");
              Thread.sleep(1000);
              ps.println("3");
              Thread.sleep(1000);
              ps.println("2");
              Thread.sleep(1000);
              ps.println("1");
              Thread.sleep(1000);
              ps.println("\u001b[2J");
              Thread.sleep(5000);
    }

  • Does anyone have an example VI about how to call the animatewindow function in the user32.dll using CLN in Labview?

      I want to call the WinAPI function-animatewindow in user32.dll to produce some special effect when showing or hidding windows, but i don't know how to using this Win API to achieve my purpose?
      Does anyone have an example VI about this application?
      Thanks in advance for your help.

    You have to use the Call Library Function Node to call Windows API functions. The animatewindow function itself has some pretty simple parameters. You first need to get the window handle. There are a set of Windows API Function Utilities (32-bit) for LabVIEW that you can use. In there there is a VI (Get Window Refnum) that gets the window handle. It's a simple call to a Windows API function. You would call the animatewindow function in the same way. In this case there are 3 parameters: the window handle (returned by a FindWindow API call), a DWORD (32-bit integer) for the duration, and another DWORD for the flags.

  • How to call the .dll use Jave

    hello,
    I will to call a .dll file in java
    which function or API can do that ?
    if someone knows , please tell me .
    thanks

    You must define "native" methods in java. The native methods allow you to call out of java into C programs (dll's on Windows, so's on unix.)
    There is a java tutorial on native methods. Look for the buzzwords JNI, which is Java Native Interface.

  • How to call the 'DETAIL' function in ALV for a program?

    Dear Friends,
    I have a prf_tree (TYPE REF TO cl_gui_alv_tree), and I added below codes to add an new button for displaying the detail record, it works fine:
    CALL METHOD prf_toolbar->add_button
        EXPORTING
          fcode     = prf_tree->mc_fc_detail
          icon      = icon_detail
          butn_type = cntb_btype_button
          text      = ''
          quickinfo = 'Show Details'.
    Everytime I click this new button, a window will popup and display the record details.
    My question is: how to call this standard function  ('DETAIL' function) in a program? for example:
    CASE ldf_ok_code.
        WHEN gcf_okcode_save.
          PERFORM okcode_save.
        WHEN 'SHOW_DETAIL'.
          CHECK  gdf_nodkey_9003 IS NOT INITIAL.
          PERFORM SHOW_DETAIL.(How to write this code to display the detail data of the selected record?)
      Thanks a lot!

    Hi,
    Go for Interactive Reporting
    like When u click on the output then it will show the Detail report u want .
    for that purpose Pls
    Use Hide command .
    And call another report
    by using SUBMITT Program

  • How to create the planning function through the process chain

    Hi guys,
    currently i am running some planning function in fortend so it is time consuming now customer want the run the planning function through the process chain any body having the idea please give me.

    Hi,
    this is standard functionality, cf.
    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/45/946677f8fb0cf2e10000000a114a6b/frameset.htm
    Regards,
    Gregor

  • How to call a php function from java...

    helllo fellow java developers!
    Im trying to figure out how I can call a php function from my java code.
    I know it sounds a bit unintiutive, seeing how java is a rich programming language, BUT java simply cannot do the task that the php script can do. It simply acts differently.
    So I am trying to call a php function, that returns a string object, and capture that string object....
    is this possible?
    something like....
    String strMyString = phpFunction( strVariable )
    ???????/ any ideaS?

    idea #1 - come up with a better plan that doesn't involve invoking php from java.
    Give one example of something php can do that java can't.
    idea #2 - forget java, and just write it in php.
    Involving multiple frameworks/languages/runtime environments is a recipe for an overcomplicated solution that will be impossible to maintain.
    I'd say keep it simple and stupid, and stick with one language.
    If you're still hooked on the idea, maybe try [this link|http://www.infoq.com/news/2007/10/php-java-stack]

  • How to pass the report parameters through java not by using URL

    Hello...
    I have an oracle App. Server 10g with report service
    I can the report using the URL :
    http://host:Port/rwservlet/report=....
    and passing the report parameters ...
    But is there any way to call the report by pdf format and passing the parameters from java without using the url ???

    thank you shahcsanjay for your reply
    but I think that web.showDocument can not be used by ordinary java web application ..
    I think it can be used only with with "oracle forms" Am I right ?
    If no can you please tell me where can I find a useful document about how to use web.showDocument ...
    thanks again
    Saleem

  • How to call the javascript file through sdk?

    I created a plugin through SDK. Now i need to call my javascript file in that plugin code(c++). Could you please advice me with some samples. This is for "Illustrator CS".
    Thanks,
    Prabudass

    I haven't the foggiest idea, except to perhaps suggest firing a script by using the AIActionManager::PlayAction command. That's assuming you can 'action' the use of a script though. If you can, it should be possible that way, if not, I have no idea.

  • How to Call abap functn/program from java layer

    Hi all,
        I have to develop a program which has to call abap function/program from java side or how to call a abap program through java ..
    pls send me related links or explanations.. dont send unrelated answers..
    Regards,
    Arivarasu S

    Hi,
    You mean accessing ABAP functions from J2EE perspective, then I think we can do this by using SAP Java Resource Adapter and also through webservices.
    SAP Java Resource Adapter (SAP JRA) can be used as an add-on for the SAP JCo SAP JRA enables the implementation of standard interfaces from diverse J2EE servers to the SAP JCo in the SAP Web AS. The SAP JRA thus simplifies
    communication with ABAP within heterogeneous J2EE landscapes.
    Go through the following links which has Good documentation on how to achieve this
    Accessing BAPIs Using the SAP Java Resource Adapter
    [https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/ad09cd07-0a01-0010-93a9-933e247d3ba4]
    Connectivity and Interoperability
    [https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/326d82e5-0601-0010-fca4-9caf27b89c26]
    Finally with WebServices. Accessing SAP Business Functions (ABAP) via Web Services
    [https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/06adbf03-0a01-0010-f386-d8e45561a3c4]
    Regards
    Raghu

  • Calling the system commands in Java

    Hi All,
    How to call the system commands in java other than using
    exec() function.For eg, in my linux machine i have used p.exec("exit") to exit from a cshell to the prompt but it is not working.Is there any other solution for this one. Pls. do provide a solution for this.It is quite Urgent.
    Thanks,
    m.ananthu

    Why not SEARCH THE F*ING FORUMS!! This has been answered SO MANY TIMES

  • Calling CVI DLL Function from Visual Studio

    HI all ,
    Iv'e created a DLL using CVI and i'm tring to call one of it's function from visual studio 6.0
    I'm getting a general error , is there a specific prototype that i need to set my functions in ordrer to call them ?!  
    Kobi Kalif
    Software Engineer

    You will need to distribute the CVI RTE along with your DLL, since anything you write in CVI is going to use the RTE.
    As far as calling the DLL functions, you can use the CVI defined macros
    <return type> DLLEXPORT DLLSTDCALL <function name> (<param1 type> <param1> ...) {
    to declare your functions in the DLL for access by a VS application.
    for example
    int DLLEXPORT DLLSTDCALL myfunction (int funparam1, double func param2) {
    There are options for identifying which functions to export from your DLL, I use "functions marked for export" but there are other choices available.  I also include a type library so when you type the name of a DLL funciton in VS6 you see a balloon popup with the function signature.  This is a check box in the target settings.  You have to create a ".fp" file (function panel file) to collect the function info for the library.
    From VB6 you can access the DLL a couple of ways, but I usually add the DLL as a reference.

  • How to call a dll which has one VISA name as input

    Hi there,
    The Labview application builder can generate a dll file from a vi which is a simple serial comunication program using VISA name as one control.
    The problem is how to call the dll file in Labview which has a VISA name as INPUT?
    Thanks!
    George

    I would suggest modifying the LabVIEW VI so that the input is a string control instead of a visa control. The LabVIEW application will work the same and there is no need for any casting. All visa VIs can take a string as an input. Then when you recreate the dll make the input a string. Then you can easily pass a string to the dll from any API.
    -Josh

Maybe you are looking for

  • Domain Trust Relationships in Windows Small Business Server 2011

    I have seen that SBS 2011 (and older SBS versions, apparently) do not 'support' Domain Trust relationships. Before coming across this information, I have already successfully created a trust relationship between a newly created SBS 2011 domain and an

  • Deleting iCal Calendars

    My iCal calendar list includes calendars that I have deleted from my Google Calendar. Deleting them in iCal get an error message, "`the server responded with an error:  calendar.google (my account).... is not a location that supports the request." If

  • Customize out-of-box taskflow with java bean.

    Hi, I have created a Taskflow Customization Appl. for changing out-of-the-box Profile (.jsff) pages. I create a Java bean under ‘ViewController’ project. I’ve tried to register the bean in either adfc-config.xml or faces-config.xml file. However, usi

  • Photos missing from iCloud after repair

    I picked up my iPhone 5 from being repaired, and now my photos are all gone--even though my wallpaper and lockscreen still have the photos from before, my camera roll is zero. The useless AppleCare chat people told me that my photos were all gone, bu

  • Cost centers

    Hi, I have the following problem: I need to delete our cost center standard heirarchy, which has been transported to the new system without its cost centers. In the heirarchy, the name of each cost center appears, but there are no cost centers create