Call a method in VB dll from Java Web Application

Hi,
I'm trying to call a method of a VB dll, from a web application developing with J2EE. Is it possible without JNI? And, if it is not possible with a tool, can you help me with an example of JNI using?
Thank you
Mary

maria_eg wrote:
I'm trying to call a method of a VB dll, from a web application developing with J2EE. Is it possible without JNI? Maybe using Runtime#exec() and rundll32.exe. Depends on the DLL which you want to call.
And, if it is not possible with a tool, can you help me with an example of JNI using?JNI tutorial: http://java.sun.com/developer/onlineTraining/Programming/JDCBook/jni.html
JNI forum: http://forum.java.sun.com/forum.jspa?forumID=52

Similar Messages

  • Call rfc from Java Web application.

    Hi:
    I am new to SAP Java programming.
    I am developing a java web application on SAP NW SP16.
    I need to call a rfc and process the data to be displayed on a jsp page.
    I have few questions...
    1) Can I use the JCO destination created in thru wed dynpro content administrator, to connect to sap and execute the rfc/bapi?
    2) How would I create and access the model (rfc)?
    3) Are the required jar and dll(rfc32.dll ... ) files available on the server?
    Any help would be greatly appreciated.
    Thanks.

    Hi,
       See the follwoing links which contains sample code to ceate JCO and execute BAPI.
    http://help.sap.com/saphelp_nw2004s/helpdata/en/6a/14e13d8ee4535ee10000000a114084/frameset.htm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/6a/14e13d8ee4535ee10000000a114084/frameset.htm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/6a/14e13d8ee4535ee10000000a114084/frameset.htm
    Kind Regards,
    S.Saravanan.

  • Can't connect to Oracle XE instance from Java web application

    I'm a long-time Java developer but can't figure this out.
    I've been pouring over the forum for over a week and can't
    find the solution that will let me connect.
    Hardware: Intel/Vista.
    DB: Oracle Express 10G.
    Application: Java web application (Jakarta Struts)
    Application Server: Tomcat 5.5
    I copied the latest JDBC driver from OTN into my app server's "/LIB" directory.
    I get no driver errors. ("ojdbc14.JAR)"
    I can connect locally from my TOAD client, using SYSTEM/PASSWORD/XE.
    My listeners seem to be OK.
    Depending on which connection string I use from my Java application,
    I get one of two messages.
    "ORA-01017: invalid username/password; logon denied"
    OR
    "Io exception: The Network Adapter could not establish the connection"
    ------------ lsnrctl status ---------------------------------------------------
    Service "CLRExtProc" has 1 instance(s).
    Instance "CLRExtProc", status UNKNOWN, has 1 handler(s) for this service...
    Service "PLSExtProc" has 1 instance(s).
    Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
    Service "XEXDB" has 1 instance(s).
    Instance "xe", status READY, has 1 handler(s) for this service...
    Service "XE_XPT" has 1 instance(s).
    Instance "xe", status READY, has 1 handler(s) for this service...
    Service "xe" has 1 instance(s).
    Instance "xe", status READY, has 1 handler(s) for this service...
    The command completed successfully
    ------------ SOURCE CODE ------------------------------------------------------
    OracleDataSource ods = new OracleDataSource();
    ods.setURL(" jdbc:oracle:thin:@localhost");
    conn = ods.getConnection("system", "password");
    //ods.setURL("jdbc:oracle:thin:@rsosborn-PC:1521:XE");
    //conn = ods.getConnection("system", "password");
    String query = "select * from books;";
    Statement st = conn.createStatement();
    ResultSet rs = st.executeQuery(query);

    Using the code you supplied I was able to reproduce your errors. I've adjusted it accordingly and can connect to one of my 10.2 test databases.
    import java.sql.*;
    import oracle.jdbc.*;
    import oracle.jdbc.pool.*;
    class Conn {
      public static void main (String args []) throws SQLException
        Connection conn = null;       
        OracleDataSource ods = new OracleDataSource();
        // ods.setURL(" jdbc:oracle:thin:@localhost:1521:TEST");
        // conn = ods.getConnection("scott", "tiger");
        ods.setURL("jdbc:oracle:thin:@localhost:1521:TEST");
        conn = ods.getConnection("scott", "tiger");
        Statement stmt = conn.createStatement();
        ResultSet rset = stmt.executeQuery("select BANNER from SYS.V_$VERSION");
        while (rset.next())
            System.out.println (rset.getString(1));   // Print col 1
        stmt.close();
    }There are several different ways to configure OracleDataSources:
    http://download.oracle.com/docs/cd/B19306_01/java.102/b14355/urls.htm#BEIDBFDF
    So, hopefully it's just a mismatch config.

  • Calling back c++ method in an exe (not a dll) from java?

    Hi all,
    I have to make an hybrid C++/java from an existing C++
    application that compiled is a big single exe not a dll.
    I'm running under win32.
    The application consists of several windows. The hybrid
    will have widows in C++ and some in java. They have the
    same menu and tool bar. In the C++, there are some
    callbacks called when a button is pressed. How to call
    these callback from java given the fact that the JVM and
    the java classes are launched by the exe file.
    I know how, from C++, start JVM and call my java window.
    I also know how to call a C++ method that is in a dll from
    java. It's from the tutorial
    http://java.sun.com/docs/books/tutorial/native1.1/index.html
    But I don't know how to call a C++ method that is in in an
    exe which has launch a JVM from an object running in this
    JVM.
    Is there somewhere an example like this?
    Thanks,
    Xavier.

    Thanks this helped.
    For those who want a complete example, here it is:
    Tested on XP, java 1.4.2, VC++ 6.0.
    ************ File invoke.cpp *****************************
    #include <stdlib.h>
    #include <jni.h>
    #ifdef _WIN32
    #define PATH_SEPARATOR ';'
    #else /* UNIX */
    #define PATH_SEPARATOR ':'
    #endif
    #define USER_CLASSPATH "." /* where Prog.class is */
    void JNICALL displayHelloWorld(JNIEnv *env, jobject obj)
        printf("Hello world: made by printf from C++\n");
        return;
    void main() {
        JNIEnv *env;
        JavaVM *jvm;
        JavaVMInitArgs vm_args;
        jint res;
        jclass cls;
        jmethodID mid;
        jstring jstr;
        jobjectArray args;
        char classpath[1024];
         int result;
        /* IMPORTANT: specify vm_args version # if you use JDK1.1.2 and beyond */
         JavaVMOption options[3];
         options[0].optionString = "-verbose:gc";
         sprintf (classpath, "-Djava.class.path=%s", USER_CLASSPATH);
         options[1].optionString = classpath;
         options[2].optionString = "-Djava.compiler=NONE";
         vm_args.options = options;
         vm_args.nOptions = 3;
         vm_args.ignoreUnrecognized = JNI_TRUE;
            vm_args.version = JNI_VERSION_1_4;
         /* IMPORTANT: Note that in the Java 2 SDK, there is no longer any need to call
          * JNI_GetDefaultJavaVMInitArgs. It causes a bug
        /* Append USER_CLASSPATH to the end of default system class path */
        /* Create the Java VM */
        res = JNI_CreateJavaVM(&jvm,(void**)&env, &vm_args);
        if (res < 0) {
            fprintf(stderr, "Can't create Java VM\n");
            exit(1);
        cls = env->FindClass("mypackage/Prog");
        if (cls == 0) {
            fprintf(stderr, "Can't find mypackage/Prog class\n");
            exit(1);
       JNINativeMethod nm;
       nm.name = "displayHelloWorld";
       /* method descriptor assigned to signature field */
       nm.signature = "()V";
       nm.fnPtr = displayHelloWorld;
       env->RegisterNatives(cls, &nm, 1);
        mid = env->GetStaticMethodID(cls, "main", "([Ljava/lang/String;)V");
        if (mid == 0) {
            fprintf(stderr, "Can't find Prog.main\n");
            exit(1);
        jstr = env->NewStringUTF(" from C++! calleded by C++, using argument from C++ but java method");
        if (jstr == 0) {
            fprintf(stderr, "Out of memory\n");
            exit(1);
        args = env->NewObjectArray(1,
                            env->FindClass("java/lang/String"), jstr);
        if (args == 0) {
            fprintf(stderr, "Out of memory\n");
            exit(1);
        env->CallStaticVoidMethod(cls, mid, args);
        jvm->DestroyJavaVM();
    }********************* File ./mypackage/Prog.java **************************
    package mypackage;
    public class Prog {
           public native void displayHelloWorld();
        public static void main(String[] args) {
            System.out.println("Hello World" + args[0] +"\n");
            Prog prog = new Prog();
            prog.displayHelloWorld();
            System.out.println("(called from java)");
            System.out.println("\nSo to sumurize:");
            System.out.println(" -1 Starting point is an exe (not DLL, there is no DLL) so C++ code");
            System.out.println(" -2 From C++ call java method using argument from C++");
            System.out.println(" -3 From java, that was launched by the exe, call to");
            System.out.println("    a native using the RegisterNatives in C++\n");
            System.out.println("You got a bidirectional example with as starting point");
            System.out.println("a single exe, launching JVM, loading class call back C++!");
    }******************* Command line for all ****************************************
    javac mypackage/Prog
    cl -I"D:\Program Files\j2sdk1.4.2_03\include" -I"D:\Program Files\j2sdk1.4.2_03\include\win32" -MT
    invoke.cpp -link D:\PROGRA~1\j2sdk1.4.2_03\lib\jvm.lib
    (Remark, the last path is using the short name for "Program Files" because with the blank
    even adding double quotes result into an error)
    You must have jvm.dll in your path for me it's Path=D:\Program Files\j2sdk1.4.2_03\jre\bin\client;
    Then simply call invoke and see the result. :-)

  • Is it possible to call a method in a servlet from  a java script ?

    I need to do a dynamic html page . In the page i select some things and then these things must communicate whit a servlet because the servlet will do some DB querys and update the same webpage.
    So is it possible to actually call a method of a servlet from a java script? i want to do something that looks like this page:
    http://www.hebdo.net/v5/search/search.asp?rubno=4000&cregion=1011&sid=69DHOTQ30307151
    So when u select something in the first list the secodn list automaticly updates.
    thank you very much

    You can
    1. load all the options when loading the page and
    set second selection options when user selected
    the first; or
    2. reload the page when user select first selection
    by 'onChange' event; or
    3. using iframe so you only need to reload part of
    the page.

  • Fall into a trouble when calling a dll from java in linux

    Hi, experts:
    I encountered a big trouble when using JNI to call a C++-compiled DLL from java in Linux: The DLL function didn't execute immediately after the invocation, and was deferred till the end of the Java execution. But all worked well after migrating to windows. This problem made me nearly crazy. Can somebody help me? Thanks in advance.
    Linux: fedora core 8, jdk1.6.0_10,
    compile options: g++ -fPIC -Wall -c
    g++ -shared

    It looks like the OP compiled the C source file and linked it into a Windows .dll, which would explain why it worked flawlessly in Windows. (Though I must say the usage of GCC would make someone think it was compiled in Linux for Linux, GCC also exists for Windows, so I'm not sure it's a Windows .dll either...)
    @OP: Hello and welcome to the Sun Java forums! This situation requires you to make both a .dll and a .so, for Windows and Linux. You can then refer to the correct library for the operating system using System.loadLibrary("myLibrary"); without any extension.
    s
    Edited by: Looce on Nov 21, 2008 11:33 AM

  • To call a VB dll from java

    Hi,
    I want to know how one can call a VB dll from Java.I know it is something like calling a C dll which in turn calls the VB dll.I also went through the tutorial provided on the sun site and was able to call a C dll through java but I still do not know how to call a VB dll from java.
    regards,
    Anshuman

    Have you checked google?
    First hit. Reply 17.

  • How would I call a method inside a dll?

    How would I call a method inside a dll? Is it even possible in Java? Like in VB you would do something like this: XXX.dll --> XXX.Activate()... I have already loaded the dll like this:
    String xxx = "C:/WINDOWS/system32/xxx.dll";
    System.load(xxx);
    Please help?
    THX

    I've got another question.
    I've gone through the link you posted and a couple others that I found.
    I am able to create an interface using the windows kernel32.dll and go through an example I found.
    But when I try to use a dll that I have from another application, I have problems.
    Here is what I have for the interface.
    public interface IAiCamDeviceControl extends StdCallLibrary {
         public IAiCamDeviceControl INSTANCE=(IAiCamDeviceControl)Native.loadLibrary("D:\\IAiCamDeviceControl.dll",IAiCamDeviceControl.class);   
    //        public long GetVersion( String s );
    //        public long Close();
    }The interface that works looks like this:
    public interface Kernel32 extends StdCallLibrary {
         public Kernel32 INSTANCE=(Kernel32)Native.loadLibrary("Kernel32",Kernel32.class);I thought that the problem might be using the path name for the library, so I copied it into the system32 directory.
    Still get the same error:
    Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load library 'D:\IAiCamDeviceControl.dll': The specified module could not be found.
    My main looks like
    public class Main {
        public static void main(String[] args) {
    //          Kernel32 lib=Kernel32.INSTANCE;
    //          Kernel32.SYSTEM_POWER_STATUS batteryStatus=new Kernel32.SYSTEM_POWER_STATUS();
    //          lib.GetSystemPowerStatus(batteryStatus);
    //          System.out.println(batteryStatus);
                IAiCamDeviceControl camDev = IAiCamDeviceControl.INSTANCE;
    }The commented part is from the version that worked.
    All I attempted to do here was just create an instance of the interface.
    Any idea why I can't access the dll?
    The dll is the same one that is used successfully in VB, C#, and C++ demo programs, so I suspect it is a good dll.

  • Calling a method of one class from another withing the same package

    hi,
    i've some problem in calling a method of one class from another class within the same package.
    for eg. if in Package mypack. i'm having 2 files, f1 and f2. i would like to call a method of f2 from f1(f1 is a servlet) . i donno exactly how to instantiate the object for f2. can anybody please help me in this regard.
    Thank u in advance.
    Regards,
    Fazli

    This is what my exact problem.
    i've created a bean (DataBean) to access the database. i'm having a servlet program (ShopBook). now to check some details over there in the database from the servlet i'm in need to use a method in the DataBean.
    both ShopBook.java and DataBean.java lies in the package shoppack.
    in ShopBook i tried to instantiate the object to DataBean as
    DataBean db = new DataBean();
    it shows the compiler error, unable to resolve symbol DataBean.
    note:
    first i compiled DataBean.java, it got compiled perfectly and the class file resides inside the shoppack.
    when i'm trying to compile the ShopBook its telling this error.
    hope i'm clear in explaining my problem. can u please help me?
    thank u in advance.
    regards,
    Fazli

  • Calling a method in BPM Object from jsf page

    Hi All,
    How do I call a method in BPM object from JSF page? Is it possible to invoke it in a manner similar to invoking a method from managed bean in JSF application?
    Please help.
    Thanks and Regards,
    Veronica

    You can use f:invoke (or f:invokea to with parameters)
    For ajax calls, you can use f:invokeUrl to get the URL to a particular method within your BPM object, although make sure the Server-Side Method property is set to Yes.
    http://download.oracle.com/docs/cd/E13154_01/bpm/docs65/taglib/index.html

  • Calling a method on a jFrame from a jPanel that created by the jFrame

    Hi all
    I can not for the life of me work out how to do this.
    Calling a method on a jFrame from a jPanel that created by the jFrame.
    I have used this code to set a handle for one jPanel to another.
    i.e I can create new jpanel and pass in handles from one to another but not back to the jFrame.
    // this is sudo code
      private Panel_Top topPanel;
      private Menu_Panel menuPanel;
      private DataPanel dataPanel;
    //create new
        topPanel = new Panel_Top();
        menuPanel = new Menu_Panel();
        dataPanel = new DataPanel();
    // add handles from one to another
        menuPanel.setDataPanel(dataPanel);
        topPanel.setDataPanel(dataPanel);
        topPanel.setMenu_Panel(menuPanel);
        dataPanel.setMenu_Panel(menuPanel);
    // in each class I use this to set
      public void setDataPanel(DataPanel dataPanel) {
        this.dataPanel = dataPanel;
      }But I can not seam to get a handle back to the jFrame that created it.
    Please help
    as you can see I am trying but no luck so far
    Thanks

    class Life extends JPanel{
          pulic Life( JFrame owner )
                owner.doSomething(); // pass the JFrame to the constructor and feel free to use it
    }[code[                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Call a method in the view from Component Controller

    Hi Friends,
    I have written the code for calling the RFC in Component Controller.
    My requirement is to change the properties of UI elements in the view, if I get any exception while calling RFC.
    Can Call a method in the view from Component Controller.
    Regards,
    Lakshmi Prasad.

    HI,
    You can get the error message during the exception of calling RFC in view itself.
    Any way you may call the RFC at some action in the view only.
    Can you explain me what you are trying to do?
    Kind Regards,
    Mukesh

  • Need call a method of one iview from another iview

    Hi,
    There are 2 iviews in a component.
    1) FirstView - contains abc() method & xyz() methods
    2) SecondView (a popup) - asdf() method
    i want to call abc() method from asdf() method. i.e. i want to call a method of the firstview from the secondview.
    Note:
    1) i couldn't able to copy the code of abc() method to component controller, as it has the code which uses (iview) local attributes (this can be done by context mapping) & main reason is from the method it calls the xyz() method of the same view (again i couldn't call a method of iview from component controller).
    2) firstView contain 5 tabs, i want to be in the same tab from which secondview (popup) was called, if i use fire plugs between both view, the current tab will be chnaged (i suppose, not sure).
    3) can we use event handlers, if yes how can we do that.
    Please provide a better solution for calling a method of view from another view.
    Thanks
    Maha
    Edited by: Maha Hussain on Jan 13, 2009 12:40 PM

    Hi Maha,
    It is better to have such methods in the component controller to make it reusable and avoid writing same code again and again.
    You can have that method in component controller and call that method on click on a button from Iview1 and can pass the parameters in the mthgod only.
    for example.
    Say Method abc() which is currently in Iview1 and you are passing values from context say aa bb cc to the method now what i am suggesting is
    have that method abc(String aa, String bb, String cc) ;
    and call it on click on button in Iview1 and pass the required parameters.
    Hope this will help
    Regards
    Narendra

  • How to call main method in one class from another class

    Suppose i have a code like this
    class Demo
    public static void main(String args[])
    System.out.println("We are in First class");
    class Demo1
    public static void main(String args[])
    System.out.println("We are in second class");
    In the above program how to call main method in demo calss from Demo1 class......???????

    No, i dont know how to call other than main methods from other classes
    And one more doubt i have i.e. Like in C can we see the execution of the program like how the code is being compiled step by step and how the value of the variable changes from step to step like(Add Watch).........

  • How to call Xcelsius in Java Web application without OpenDoc

    Hi,
    We require to call Xcelsius Dashboard from a Java Web application. We cann't use OpenDoc function as result of some client preferences/restrictions
    Please let me know, what would be the other method to call the Xcelsius Dashboard from a Web application.
    Regards,
    Sachin

    Xcelsius docs are in swf format.  You could probably just host them without security and view with flash.

Maybe you are looking for

  • Retriving Absence data from PNP logical database

    hi all, there is an function where i can get the absence data but my client wants in the following order But my client wants the report in following format: YEAR--- week number-- number of absence hourse in that week 2006 - WEEK - HOURS infotype is p

  • When printing in Adobe, missing the Custom Scale option.

    Adobe Version 11.0.2 Windows 7 64 bit. Doesn't matter what type of network printer I select.  When selecing to print a document, under Page Sizing & Handling, there is no "Custom Scale" option.  There is on other workstations.  Thank you.

  • Problem when connect to SAP

    Hi All! When i create an Addon Application I Register String to connect to SAp by: Right click in my app/properties/Debug/ and input command line Agruments. And in myclasses I call: Private Sub SetApplication()         '// Use an SboGuiApi object to

  • No automatic prints for GR for production order

    Hi All, We have created a new Z output type by copying output type WF01 for our project. I have maintained this outpit type in the schema and mainatined a condition record for this output as well in MN21. But when we do the podcution order confirmati

  • My i pod touch wont sync apps from computer

    my i pod touch first generation 8G wont sync apps onto my i pod from i tune on computer pleaze HELP!!!!!