Call a C# dll from java is work only with the machine which is build C# dll

hi all,
I've built a VC++(win32 console dll app)..
Created a Java program to access the said VC++ dll
It was successful in the machine(say machine 1) which is created the VC++ dll..But Not work with machine2
n.b VC++ dll is accessing another VC#dll
If I combile the VC++ dll in machine2 then then its works fine with machine2 while access from java But not work with machine1
Problem comes when I run the same application in a different system where all the
needed visual studio files are installed...
I tried by create the VC++ dll with skipping the part of accessing VC# dll, then it works fine with anotther machine
NB: error accurs only when it is run on a different machine...
Error is:
# An unexpected error has been detected by HotSpot Virtual Machine:
# Internal Error (0xe06d7363), pid=4024, tid=4028
# Java VM: Java HotSpot(TM) Client VM (1.5.0_09-b01 mixed mode, sharing)
# Problematic frame:
# C [kernel32.dll+0x1eb33]
# An error report file with more information is saved as hs_err_pid4024.log
# If you would like to submit a bug report, please visit:
# http://java.sun.com/webapps/bugreport/crash.jsp
i've done "googling" with this error... but no one has come up with some satisfactory answer...
Pls help.....
conf. of both machine
Windows XP
jdk1.5.0_09, jre1.5.0_09
thanks in advance..

Normally any system exception that occurs when working with JNI is caused by one of the following.
- pointer problems
- incorrect usage of another api
- bug in the api being used.
The last two are often still pointer problems.
The fact that it ones one machine and not another makes it more likely it is a pointer problem (in one or more of the above.)
A pointer problem cause cause the system to fail long after the point where the bug actually is (coded.) Different execution paths, such as running on different machines, means the bug will manifest itself differently.

Similar Messages

  • Validate.nullTest working only with the EMAIL button

    Hello,
    This piece of code is working just great when submiting a form by
    email.
    TextField1.validate.nullTest = "error"; (highlighting the empty fields when pushing the EMAIL button)
    On the print button it doesn't have any effect. How can I highlight
    the required fields when clicking the print button the same easy way
    as with the email button? (I have other highlighting scripts but I want to use the exact same method as used on EMAIL)
    Your input is really appreciated! And any explanations for this stupid behavior?

    To make this functionality you can use two buttons trick:
    First button Print, onClick event should has this script: realPrintButton.execEvent("click").
    Second button is invisble Print button.
    So, when you click on your first button print validation is appear and real print will be executed.

  • Resizing of the navegation and search bars seems to work only with the default set of icons.

    Unless the default set is restored, the double-headed arrows do not appear.

    Do you happen to have Dial Assist on? This is in Settings>Phone. This is what helps the phone identify international numbers when dialing, based on location. See if turning that off/on makes a difference. Unless you are making a number of international calls, I believe this can be left off. See the User Guide http://manuals.info.apple.com/MANUALS/1000/MA1565/en_US/iphone_user_guide.pdf  Page 49 has info regarding Dial Assist.

  • When I bought my D800, lightroom would not read my big files, so I had to transform them into DNG .. should I keep the DNG or the NEF files? Now, I started working only with the NEF, so I don't have this problem anymore -

    when I bought my D800, lightroom would not read my big NEF  files .. I went crazy…. so I found out I had to transform them into DNG .. should I keep the DNG or the NEF files? Now, I tried again and I am being able to work with the NEF files … don't understand…. anyway … I have to throw away some files … they are to big … should I throw the NEF or the DNGs? (as the DNGs are not edited yet…)

    Hard to say why you couldn't open them first time around...possibly low memory?
    In any event, as to the question about which to keep. This is a topic that is argued long and hard here and in other forums.
    For myself, I use only the NEF files and don't bother with DNG at all. Just can't see any long term advantage to force me to do all that extra work. Others feel that the "universal" format of DNG make it worthwhile.
    Either way, it's hard to justify keeping both (though a few people do).
    good luck
    tom

  • My early 2011 MacBook Pro says battery not detected and does not work with a new battery either. Works only with the charger plugged in.

    About a year back i had replaced the MLB of my early 2011 macbook pro and it was all working fine. A month back my battery went dead saying "Battery Not Detected". I went to Ample technologies, Bangalore, India and gave it for diagnosis. Ample technologies are the authorized Apple support service in Bangalore, India. After 3 days and no phone calls they email me that "They feel that the MLB MIGHT be the problem and they want to test it by replacing the MLB and i have to pay for their testing". I had already spent 40k indian rupees ($700) less than a year back to replace an MLB and now they want to replace it again at the cost of 43k ($750) indian rupees. I have no idea what to do now. Spending 80k indian rupees ($1400) in less than a year to replace the MLB twice sounds unfair to me. Can someone help me out here ? Is there a valid warranty period applicable , since i have changed the MLB a year back ?

    short of doing a SMC reset, you maybe at their mercy.
    resetting the  SMC http://support.apple.com/kb/ht3964
    You can try yourself running the Apple Hardware Test- and see if it generates any error codes. Post the results
    AHT  http://support.apple.com/kb/HT1509

  • I can't get the volume to work on my ipod. works only with the headset in. Thanks

    Hello I can't get the volume to work on my ipod touch. Only works witht the headset. Thanks

    Try:
    - Reset the iOS device. Nothing will be lost
    Reset iOS device: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Reset all settings
    Go to Settings > General > Reset and tap Reset All Settings.
    All your preferences and settings are reset. Information (such as contacts and calendars) and media (such as songs and videos) aren’t affected.
    - Restore from backup. See:                                 
    iOS: How to back up           
    - Restore to factory settings/new iOS device.
    -  Make an appointment at the Genius Bar of an Apple store.
    Apple Retail Store - Genius Bar

  • 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

  • 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. :-)

  • 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

  • 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.

  • Call visual prolog program from java

    Hi friends,
    is there someone help me to call ( run) prolog program from java.
    i write a parser with Javacc parser generator and stored parsed information in prolog database and I want create some query in java that work in the prolog file.
    how can i combine java and prolog programs. i used visual prolog.
    Can someone help me?
    Thanks you in advance.
    yours sincerely,
    ksu

    Since visual prolog can produce dll's, you can use JNI:
    http://java.sun.com/j2se/1.4.2/docs/guide/jni/index.html

  • How to call a VB application from Java

    Hi,
    does anybody know how to call a VB application from java.
    Would appreciate if you can provide me with an example.
    thanks

    try exec()ing the cad program with the name of the file as a command line parameter...
    Runtime.getRuntime().exec("CADProg.exe Test.prt");
    i have no clue if this will work but it seems like it's worth a try.

  • Problem while Calling a CGI pgm From Java with code sample

    Hey guys,
    I am calling a CGI program from java servlet, while calling cgi program I am passing encoded(Base64) content via post process,
    My problem is the encoded data is not posted as expected, the encoded data is corrupting. But when I send encoded data in a text file, cgi program is perfectly decoding and working fine.
    Here I am doing Base64 encoding as per requirement, I cannot avoid this encoding.
    My doubt is about OutputStreamWriter constructor argument , In OutputStream Constructor I am passing one argument is OutputStream object and another argument is encoding type. I tried with ASCII, US-ASCII & UTF-8 .
    My code is as follows, please help me to resolve this issue.
    URL url = new URL("CGI server path");
    URLConnection urlConnection = url.openConnection();
    urlConnection.setDoOutput(true);
    OutputStream os = urlConnection.getOutputStream();
    BufferedOutputStream buffer = new BufferedOutputStream(os);
    OutputStreamWriter  writer = new
                                                   OutputStreamWriter(buffer, "US-ASCII");
    writer.write(encodedPDF-Content);
    writer.write("\r\n");
    writer.flush();
    writer.close();
    here encodedPDF-Content is String and it's size is 9565 bytes

    Whenever you read something in java into string (with Reader implementation) it expects source to contain text in encoding you specified. It then decodes it and makes 16 bit unicode string from it. Whenever you store string using Writers it does reverse operation with specified encoding (may be different than this which you used to read source) and stores text as a sequence of bytes made of 16 bit unicode string. So, passing text back and forth between programs with the help of files or I/O you can make mistake at both reading and writing encoding. Check for it.
    Now, when C programm or other application reads file it may take another assumptions about encoding or may even completly ignore it and read source as a binary file. Then, if you have a source text as a file and have to pass it to other application never do it using Reader/Writer. User raw InputStream/OutputStream instead what will preserve all information unchanged.
    here encodedPDF-Content is String and it's size is 9565 byteHow id you get this info? String.length() gets you how many chars is in it, it will be half the number of bytes. If you see your input file beeing 9565 bytes long, see my above statements.

  • Calling packaged stored procedure from Java

    Hi All,
    I'm trying to call a stored procedure from Java but I'm having
    problems with registrating the output parameter. I'm getting
    the error: Conflicting parameters.: sqltype=2003
    This is the stored procedure which is located in a package in
    the Oracle database:
    package Pack_GetAgencyInformation as
    Type InfoType is record ( agen_code varchar(3), agen_designation
    varchar(30), agen_adresse varchar(60), agen_tel varchar(12) );
    function GetAgencyInformation( P_AGENCE VARCHAR )
    return Pack_GetAgencyInformation.InfoType
    end Pack_GetAgencyInformation;
    This is the Java source from where I'm calling the procedure:
    //DriverManager.registerDriver (new
    oracle.jdbc.driver.OracleDriver());
         Class.forName("oracle.jdbc.driver.OracleDriver");
    Connection conn = DriverManager.getConnection
    ("jdbc:oracle:thin:@164.48.69.125:1521:ventes", "system", "*****
    // @machineName:port:SID,
    userid, password
    CallableStatement cs = conn.prepareCall("{ ? = call
    Pack_GetAgencyInformation.GetAgencyInformation( ? )}");
         try {
              cs.registerOutParameter( 1,
    oracle.jdbc.driver.OracleTypes.ARRAY);
         } catch (SQLException e) {
              e.printStackTrace();
         cs.setString(2, "001" );
         //ResultSet rset = cs.executeQuery();
    The stacktrace:
    java.sql.SQLException: Parametertypen conflicteren.:
    sqlType=2003
    at oracle.jdbc.dbaccess.DBError.throwSqlException
    (DBError.java:168)
    at oracle.jdbc.dbaccess.DBError.throwSqlException
    (DBError.java:210)
    at
    oracle.jdbc.driver.OracleCallableStatement.registerOutParameter
    (OracleCallableStatement.java:220)
    at
    oracle.jdbc.driver.OracleCallableStatement.registerOutParameter
    (OracleCallableStatement.java:350)
    at dbAccess.main(dbAccess.java:25)
    I think it has to do with the type InfoType which is created in
    the Stored Procedure. I'm absolute no Oracle expert and I
    prefer not to make changes to the Oracle database. So any
    solution in Java is welcome!
    BR, H.Rietman

    I managed to get it to work only by changing the stored
    procedure. I have changed the return type record to a Ref
    Cursor type (had to change alot of code for this). It seams
    that Oracle JDBC drivers DON'T support the Record type as a
    return type.
    So the next question is: is it possible to typecast a record
    type to a ref cursor type in Oracle. In this way I can easily
    change the return type for the stored procedures.
    /Harald

  • About dll from java swing

    Hi,
    I hava class (send sms from java) in dll - ActiveXComponent type, his name: SMSCom
    dll name: SMSSender
    that get in his constractor: (in VB I wrote this)
    SMSObj.password = password;
    SMSObj.Username = user;
    SMSObj.Source = phone;with this code I'm connect to the dll file and his object, but
    I don't know how to give this object this parameters.
    ActiveXComponent ax = new ActiveXComponent("SMSCom.SMSSender");
    Dispatch SMSObj = (Dispatch) ax.getObject();Thanks alot for any help :)

    Thank you so moch, you helped me alot!!!!!
    I you coul'd help me with last little thing I'll be happy:
    but I have error, it is not attached to your help, the error link to this line
    (I have jacob.dll +jacob.jar)
    ActiveXComponent ax = new ActiveXComponent("SMSCom.SMSSender");the error messege:
    Exception occurred during event dispatching:
    com.jacob.com.ComFailException: Can't get object clsid from progid
         at com.jacob.com.Dispatch.createInstance(Native Method)
         at com.jacob.com.Dispatch.<init>(Dispatch.java)
         at com.jacob.activeX.ActiveXComponent.<init>(ActiveXComponent.java)
         at com.matarotqm.QM6.model.Test1.<init>(SmsDll.java:51)
         at com.matarotqm.QM6.model.SmsDll.<init>(SmsDll.java:27)
         at com.matarotqm.QM6.view.Sms.actionPerformed(Sms.java:273)
         at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
         at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
         at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
         at java.awt.Component.processMouseEvent(Unknown Source)
         at javax.swing.JComponent.processMouseEvent(Unknown Source)
         at java.awt.Component.processEvent(Unknown Source)
         at java.awt.Container.processEvent(Unknown Source)
         at java.awt.Component.dispatchEventImpl(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Window.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.Dialog$1.run(Unknown Source)
         at java.awt.Dialog$2.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.awt.Dialog.show(Unknown Source)
         at java.awt.Component.show(Unknown Source)
         at java.awt.Component.setVisible(Unknown Source)
    I have in this object (SMSObj) method that I have to set her text as String and phone as String.
    do I call method from SMSObj like this?
    System.out.println("Calling method..");
    Dispatch.call(SMSObj,"SendSMS","Hello From Java","0507657661");

Maybe you are looking for

  • Connect MBP to external Samsung monitor

    Hi all, I see similar q & a's but not exactly this :- I have a late '09 MPB (pre thunderbolt), I want to connect to a Samsung SyncMaster 940MW. I currently run 2 of these synmasters as a dual display for my MacPro with no problems using two DVI cable

  • How to see Live cache order number in planning book of APO ?

    I am trying to see the Live cache order number in Planning book by entering getio as T-code while in planning book. By this I am not able to see the LC details. Can anyone help me out on the same? Edited by: Wilian Segatto on May 16, 2010 2:52 PM

  • HTTP Connection For Proxies

    Hi all, Can anyone explain me how to create the http connection in SM59. Here iam getting a status error as HTTP_CONNECTION_FAILED here my scenario is File to Proxy Suggest me where i have to make this connection means in XI or SAP system regarding t

  • Show front panels of sub VIs when running a EXE (build application)

    I've created a exe file and it works fine. However, it only shows the front panel of main VI and I can not open sub VIs (it looks like they are all hidden). I know it can be done by creating a library file along with this exe file, but that's not wha

  • Different between models

    On MSI product page, there are 3 different models of the 865PE motherboard: 865PE Neo2-FIS2R 865PE Neo2-S 865PE Neo2-LS I looked through the articles and can find no difference in the models.  Plz some1 fill me in on the difference between these.