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.

Similar Messages

  • How to call a .bat file from java code?

    How to call a .bat file from java code? and how can i pass parameters to that .bat file?
    Thanks in advance

    thanks for ur reply
    but still i am getting the same error.
    I am trying to run a .bat file of together tool, my code looks like below
    import java.lang.Runtime;
    import java.lang.Process;
    import java.io.File;
    class SysCall{
         public static void main(String args[]){
              String cmd="D://Borland//Together6.2//bin//Together.bat -script:com.togethersoft.modules.qa.QA -metrics out:D://MySamples//Metrics// -fmt:html D://Borland//Together6.2//samples//java//CashSales//CashSales.tpr";
              //String path="D://Borland//Together6.2//bin//Together.bat ";
              Runtime r= Runtime.getRuntime(); //Declare the system call
              try{
                   System.out.println("Before batch is called");
                   Process p=r.exec(cmd);
                   System.out.println(" Exit value =" + p.exitValue());
                   System.out.println("After batch is called");
              /*can produce errors which must be caught*/
              catch(Exception e) {
                   e.printStackTrace();
                   System.out.println (e.toString());
    I am getting the below exception
    Before batch is called
    java.lang.IllegalThreadStateException: process has not exited
    at java.lang.Win32Process.exitValue(Native Method)
    at SysCall.main(SysCall.java:17)
    java.lang.IllegalThreadStateException: process has not exited

  • Call of BW queries from ABAP code

    Has anybody information about how is it possible to call a BW query from ABAP code with parametrization (specifying characteristics) ? In our development project it's a crucial part, beacuse we have to provide interim function modules to carry out some conversion routine on BW provided data, before we put it on the screen embedded in a Visual composer Iview.

    Have a look at this:
    Calling BW queries programatically (also posted on BW forum)
    Hope it helps.
    Regards

  • Calling LV created DLL from LV

    Howdy-
    I'm trying to call a LV DLL from within LV (seperate project).  Once the DLL has been comppiled I'm using the Import Shared Library to create the node.
    However when I try this I get an error message with the import that appears to have trouble with LVBoolean and int32_t.
    I've created a simple DLL (adds a DBL to an INT 32 and creates a Bool when the sum is > 0). 
    Compiling this DLL and trying to import it has the same issue.
    Any clues?
    Attachments:
    Import Shared Lib.png ‏49 KB
    My DLL.zip ‏34 KB

    nathand wrote:
    This does mean LabVIEW will create the datatypes with U8 instead of booleans, which you can replace yourself with a boolean after importing.
    Except that the Call Library Node doesn't allow for configuration of an explicit boolean type (for obvious reasons as there is no standardized boolean datatype in C before C11 and even then the standard says nothing about if it should be a byte or the prefered integer size for the current platform or anything else). LabVIEW then uses Adapt to Type instead, which forces the skalar parameter to be always passed by pointer!
    Most simple solution is to still use an explicit integer that is properly sized and convert between the LV Boolean and the integer on the diagram.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

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

  • JVM dies when JNI native code causes a SIGABRT from assertions

    Hi,
    I am wondering whether there is a way to prevent the JVM from dying when the JNI native code hits an assertion.
    #include "NativeTest.h"
    #include <assert.h>
    JNIEXPORT jstring JNICALL Java_NativeTest_sayHello (JNIEnv *env, jobject thisobject, jstring js)
    assert(0);
    return js;
    Calling this code from Java through JNI causes a SIGABRT when assert(0) is hit. This causes the java program to terminate. Is there a way for the JVM to recover from the SIGABRT from the native code?

    929919 wrote:
    I am wondering whether there is a way to prevent the JVM from dying when the JNI native code hits an assertion.There is no way to prevent the VM from exiting if native code does anything that causes an exit.
    An assertion is only one way that can happen.
    So to prevent the VM from exiting - don't run native code. The safe way to execute OS native library is to do the following.
    1. Wrap the library in an executable.
    2. Create a communications API for the executable.
    3. Manage the executable via Java Runtime.exec/ProcessBuilder.
    4. Talk to the executable using the communications API from 2 in the java code.
    The above is safe because if the library exits it exits the executable, not the VM.

  • Calling a VC++  DLL from a java code!!!!  Urgent!!!

    Hi,
    I need a Java code which will call a VC++ dll .(similarly the viceversa also.....from vc++ calling a java application)
    If any one have the code Please send it...
    Thankx,
    Donam.

    There is also some details in here which might save you some of the hassle I had.
    http://forum.java.sun.com/thread.jsp?forum=52&thread=210212

  • Exception in native code causing Tomcat to crash

    I am running a java servlet on Tomcat and have noticed that it has been unexpectedly terminating quite a bit over the last month or so. Yesterday it happened twice, citing an exception in native code outside the VM. I really have no idea where to start debugging this. Below is what is in the log file that is generated when it terminates. Does anybody know why something like this would be happening? Looking at the stack trace, it looks like a strange place to be terminating? Has anybody come accross anything like this? If you need more information, let me know!
    Thanks!!!
    An unexpected exception has been detected in native code outside the VM.
    Unexpected Signal : EXCEPTION_ACCESS_VIOLATION occurred at PC=0x77F4200B
    Function=RtlEnterCriticalSection+0xB
    Library=C:\WINDOWS\system32\ntdll.dll
    Current Java thread:
    at sun.jdbc.odbc.JdbcOdbc.allocConnect(Native Method)
    at sun.jdbc.odbc.JdbcOdbc.SQLAllocConnect(JdbcOdbc.java:114)
    at sun.jdbc.odbc.JdbcOdbcDriver.allocConnection(JdbcOdbcDriver.java:929)
    at sun.jdbc.odbc.JdbcOdbcConnection.initialize(JdbcOdbcConnection.java:126)
    at sun.jdbc.odbc.JdbcOdbcDriver.connect(JdbcOdbcDriver.java:174)
    - locked <02F7D2F0> (a sun.jdbc.odbc.JdbcOdbcDriver)
    at java.sql.DriverManager.getConnection(DriverManager.java:512)
    - locked <06A87EB0> (a java.lang.Class)
    at java.sql.DriverManager.getConnection(DriverManager.java:193)
    - locked <06A87EB0> (a java.lang.Class)
    at com.lmp.iomada.servlets.LMPPersistence.buildObjects(LMPPersistence.java:56)
    at com.lmp.iomada.servlets.LMPServlet.transformHTML(LMPServlet.java:635)
    at com.lmp.iomada.servlets.LMPServlet.doGet(LMPServlet.java:71)
    at com.lmp.iomada.servlets.LMPServlet.doPost(LMPServlet.java:82)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java)
    at org.apache.tomcat.facade.ServletHandler.doService(Unknown Source)
    at org.apache.tomcat.core.Handler.invoke(Unknown Source)
    at org.apache.tomcat.core.Handler.service(Unknown Source)
    at org.apache.tomcat.facade.ServletHandler.service(Unknown Source)
    at org.apache.tomcat.core.ContextManager.internalService(Unknown Source)
    at org.apache.tomcat.core.ContextManager.service(Unknown Source)
    at org.apache.tomcat.modules.server.Ajp12Interceptor.processConnection(Unknown Source)
    at org.apache.tomcat.util.net.TcpWorkerThread.runIt(Unknown Source)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(Unknown Source)
    at java.lang.Thread.run(Thread.java:536)
    Dynamic libraries:
    0x00400000 - 0x00406000 c:\j2sdk1.4.1_03\bin\java.exe
    0x77F40000 - 0x77FFA000 C:\WINDOWS\system32\ntdll.dll
    0x77E40000 - 0x77F34000 C:\WINDOWS\system32\kernel32.dll
    0x77DA0000 - 0x77E30000 C:\WINDOWS\system32\ADVAPI32.dll
    0x77C50000 - 0x77CF5000 C:\WINDOWS\system32\RPCRT4.dll
    0x77BA0000 - 0x77BF4000 C:\WINDOWS\system32\MSVCRT.dll
    0x6D340000 - 0x6D46B000 c:\j2sdk1.4.1_03\jre\bin\client\jvm.dll
    0x77D00000 - 0x77D8F000 C:\WINDOWS\system32\USER32.dll
    0x77C00000 - 0x77C44000 C:\WINDOWS\system32\GDI32.dll
    0x76AA0000 - 0x76ACC000 C:\WINDOWS\system32\WINMM.dll
    0x6D1E0000 - 0x6D1E7000 c:\j2sdk1.4.1_03\jre\bin\hpi.dll
    0x6D310000 - 0x6D31E000 c:\j2sdk1.4.1_03\jre\bin\verify.dll
    0x6D220000 - 0x6D239000 c:\j2sdk1.4.1_03\jre\bin\java.dll
    0x6D330000 - 0x6D33D000 c:\j2sdk1.4.1_03\jre\bin\zip.dll
    0x76F50000 - 0x76F63000 C:\WINDOWS\system32\Secur32.dll
    0x6D2E0000 - 0x6D2EE000 C:\j2sdk1.4.1_03\jre\bin\net.dll
    0x71BB0000 - 0x71BB9000 C:\WINDOWS\system32\WSOCK32.dll
    0x71C00000 - 0x71C18000 C:\WINDOWS\system32\WS2_32.dll
    0x71BF0000 - 0x71BF8000 C:\WINDOWS\system32\WS2HELP.dll
    0x71B20000 - 0x71B63000 C:\WINDOWS\system32\mswsock.dll
    0x71AE0000 - 0x71AE8000 C:\WINDOWS\System32\wshtcpip.dll
    0x6D260000 - 0x6D26B000 C:\j2sdk1.4.1_03\jre\bin\JdbcOdbc.dll
    0x0B3E0000 - 0x0B41A000 C:\WINDOWS\system32\ODBC32.dll
    0x70BC0000 - 0x70C50000 C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_5.82.0.0_x-ww_8A69BA05\COMCTL32.dll
    0x77380000 - 0x77B5D000 C:\WINDOWS\system32\SHELL32.dll
    0x77290000 - 0x772D9000 C:\WINDOWS\system32\SHLWAPI.dll
    0x762B0000 - 0x762F7000 C:\WINDOWS\system32\comdlg32.dll
    0x70AD0000 - 0x70BB6000 C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.100.0_x-ww_8417450B\comctl32.dll
    0x0B580000 - 0x0B597000 C:\WINDOWS\system32\odbcint.dll
    0x0B720000 - 0x0B73A000 C:\WINDOWS\system32\odbccp32.dll
    0x77160000 - 0x77285000 C:\WINDOWS\system32\ole32.dll
    0x77B90000 - 0x77B98000 C:\WINDOWS\system32\VERSION.dll
    0x76ED0000 - 0x76EF7000 C:\WINDOWS\system32\DNSAPI.dll
    0x76F70000 - 0x76F77000 C:\WINDOWS\System32\winrnr.dll
    0x76F10000 - 0x76F3F000 C:\WINDOWS\system32\WLDAP32.dll
    0x76F80000 - 0x76F85000 C:\WINDOWS\system32\rasadhlp.dll
    0x0FFD0000 - 0x0FFFD000 C:\WINDOWS\system32\rsaenh.dll
    0x76B70000 - 0x76B7B000 C:\WINDOWS\system32\PSAPI.DLL
    0x76C10000 - 0x76C38000 C:\WINDOWS\system32\imagehlp.dll
    0x6D580000 - 0x6D621000 C:\WINDOWS\system32\dbghelp.dll
    Local Time = Tue Jun 01 21:23:49 2004
    Elapsed Time = 5644
    # The exception above was detected in native code outside the VM
    # Java VM: Java HotSpot(TM) Client VM (1.4.1_03-b02 mixed mode)

    Library=C:\WINDOWS\system32\ntdll.dll
    Current Java thread:
    at sun.jdbc.odbc.JdbcOdbc.allocConnect(Native Method)
    at sun.jdbc.odbc.JdbcOdbc.SQLAllocConnect(JdbcOdbc.java:114)
    at sun.jdbc.odbc.JdbcOdbcDriver.allocConnection(JdbcOdbcDriver.java:929)
    at sun.jdbc.odbc.JdbcOdbcConnection.initialize(JdbcOdbcConnection.java:126)
    at sun.jdbc.odbc.JdbcOdbcDriver.connect(JdbcOdbcDriver.java:174)
    The stack trace points to an error in ntdll.dll, the NT system calls library, while it being used by Sun's standard ODBC driver.
    There are two unfixed bugs against 1.4 in this area. One suggests incorrect usage of the driver by client code. The other suggests that the current Java library has poor handling of exceptions in system code.
    http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4812268
    http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4641011
    The latter does not explort the actual cause of exceptions - they will have something to do with your Windows configuration. Applying the latest NT service packs might help. Unfortunately as the bug report indicates, this issue will not be fixed in 1.4.

  • Does JVM variable java.library.path make sense from native code?

    Hello all,
    Well, everybody loads native library from the Java side by calling System.loadLibrary("myNative").
    But what if, for example, myNative.dll loads another two libraries itself?
    Suppose, when I call java method "initMyNative", it in turn call native function Java_initMyNative(...). That Java_initMyNative(...) wants to load two native libraries and make: HINSTANCE lib01 = LoadLibrary("auxlib01.dll");  // LoadLibrary from capital, it's Win function!
    HINSTANCE lib02 = LoadLibrary("auxlib02.dll");  // LoadLibrary from capital, it's Win function!As specified, native LoadLibrary call will look for auxlib01.dll and auxlib02.dll in catalogs which are enumerated in system variable PATH, current catalog.
    Does java.library.path make any sense on order of such search?
    If not, is there any way of flexible configuring of the catalog in which to look auxlib01.dll and auxlib02.dll for?
    I see some ways:
    * changing system variable PATH - not flexible
    * passing content of java.library.path into native code, parsing it and looking for auxlib01.dll and auxlib02.dll in each catalog listed in java.library.path - too heavy
    I hope there is more smart way to do that.
    Thanks, Alex

    Thank you Shane for your reply. I actually didnt have to create 2 jar files, one for Java files and one for the dll file. I got an idea from your post and referenced the same jar file twice by saying:
    <j2se version="1.2+" />
    <jar href="HelloWorld.jar"/>
    <nativelib href="HelloWorld.jar"></nativelib>
    and by saying that the jnlp file started working from the browser.
    Again, thanks a lot for your replies.
    Thanks
    Nick

  • How to call a labview dll from excel-VBA?

    How to call a simple Labview DLL from Excel VBA?
    I have seen examples of DLL calls from VB but does it work the same way for VBA? I have 2000 excel and Labview 8.5. I created the DLL and tried to call it from VBA using the same type of code as in NI's website example(ofcourse its a bit diff with 8.5)
    http://zone.ni.com/devzone/cda/tut/p/id/...
    BUT it errors out when called from excel
    ERROR: The object invoked has disconnected from its client

    You would need to provide more details about the LabVIEW DLL, such as the prototypes of the functions (VIs) that you're trying to call, and your actual VBA code. Specifically, what object you're trying to create. You should also make sure the Run-Time Enginer is installed, as well as any required libraries such as the VISA Run-Time if you're using VISA. Have you made sure to enable the ActiveX server for the DLL?
    A search yielded the following items that you may wish to peruse:
    http://forums.ni.com/ni/board/message?board.id=170&message.id=261345&requireLogin=False
    http://forums.ni.com/ni/board/message?board.id=170&message.id=45099&requireLogin=False
    http://forums.ni.com/ni/board/message?board.id=170&message.id=299209&requireLogin=False
    http://forums.ni.com/ni/board/message?board.id=170&message.id=195846&requireLogin=False

  • Calling a PL/SQL from Forte code

    Hi, We are using the Sun UDS 5.1.3
    I need to call directly from the code a PL/SQL stored procedure. It is true that this would defeat the Forte layer purpose but I have a very specific case. Is there an easy way to do so?

    I don't remember how after all these years, but I remember that I made a native Informix call in a special way. So it seems logical that you should be able to do the same for Oracle...
    Scott

  • Call existing C apliction from java

    hi all,
    I try this
    http://java.sun.com/docs/books/tutorial/native1.1/stepbystep/index.html for JNI.
    we need to write the native method implementation in such a way that the method signature should exactly match the method signature created in the header file.
    i want to provide interface to existing c application without distubing code taking input from stdin before
    now i want java to pass that parameter and result return back in java aging

    You don't need JNI for this task. Runtime.exec() is enough. Run you C application and pass arguments using stream then get result using other stream.

  • Calling 64-bit dll from labview 8.2 on Windows7

    Hello,
    I have tried the LABview driver from the OMNIDRIVER (OceanOptics) package. But when calling functions from the “OmniDriver32.dll” , LABView is crashing and  says that the memory is corrupted.
    I am using LABVIEW 8.2 (32-bit) running on Windows 7 (64-bit).  I have tried some LABView code examples given for LABview 7.1 and 8.0. These example are using the OmniDriver32.dll (not the OmniDriver64.dll).
    But maybe these example are assuming that you are on a 32-bit operating system, which is not my case.
    So I have tried calling the OmniDriver64.dll. but LABView seems not to recognised the dll and can’t read the included functions.
    Is there a way to call some 64-bit dll from LABview 8.2 ?
    Or do I need to buy a new license for LABVIEW 64-bit ?
    Thanks,
    Pierre

    There is no virtualization support for DLL bitness issues outside of the Windows standard directories. The Windows and System directories that an application "sees" depends on its bitness. All other directories are not mapped depending on the calling process' bitness.
    So if you have installed 32 Bit LabVIEW and are not calling one of the system DLLs, you have to point the path of the DLL to the real 32 bit DLL. Pointing it to a 64 bit DLL should not even be able to get the VI compilable, since Windows will refuse to load the DLL into the 32 bit process as being an unknown file format, and that should make the VI broken.
    If you need to call a system DLL you simply enter the DLL name without path and Windows will find the according DLL for LabVIEW.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • How to modify an existing xml file from java code.

    Hi
    I have worked on creating a new xml file from java code using xmlbeans.But if i try to modify an already existing file using java code I am unable to get errorfree xmlfile.
    For example if xml file(studlist.xml) is as below:
    <?xml version="1.0" encoding="UTF-8"?>
    <StudentList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="D:\kchaitanya\xmlprac1\abc\Studlist.xsd">
         <Student>
              <Name>ram</Name>
              <Age>27</Age>
         </Student>
    <Student>
              <Name>sham</Name>
              <Age>26</Age>
         </Student>
    </StudentList>
    Now suppose i have set name to victor using student.setName,
    and set age to 20 using setAge from javacode,
    the new xml file is as follows:
    <?xml version="1.0" encoding="UTF-8"?>
    <StudentList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="D:\kchaitanya\xmlprac1\abc\Studlist.xsd">
         <Student>
              <Name>ram</Name>
              <Age>27</Age>
         </Student>
    <Student>
              <Name>sham</Name>
              <Age>26</Age>
         </Student>
    </StudentList>
    <Student>
              <Name>victor</Name>
              <Age>20</Age>
         </Student>
    As observed this is not a valid xml file.But how can i modify without any errors?

    I know it's an old post, but I found this while doing a google search for something else, and don't like to leave it un-aswered
    Just in case anyone has a similar problem... In this case the new elements have been appended outside of the root element
    What you need to do is first get the root element and then append the new children to that, there are several ways of getting the root element, which depend on what you want to do with the elements you get back here's a simple (incomplete) way.
    // gets the root element of the specified file (code not shown)
    Element rootElement= new SAXReader().read(file).getRootElement();Then just append the new elements as below (this is non-generic code and would need to be modified for your situation)
    // write a new student element
    Element student = document.createElement("Student");  // creates the new student
    rootElement.appendChild(student); // ***appends it to the root element***
    Element name = document.createElement("Name"); // creates the name element
    name.appendChild(document.createTextNode("Fred")); // adds the name text to the name element
    student.appendChild(name); // appends the name to the student
    Element age= document.createElement("Age"); // creates the age element
    age.appendChild(document.createTextNode("26")); // adds the age text to the age element
    student.appendChild(age); // appends the name to the studentThen flush ya buffers or whatever and write the file
    Edited by: Dream-Scourge on Apr 23, 2008 11:10 AM

  • Calling a javascript function from java code and getting tha value in Java

    Hi,
    I would like to call a Java script function confirmRemove() from Java code upon meeting a condition..
    for example the code snippet is:
    if(true){
    // I want to call js confirmRemove() over here. And get the value of variable "answer" in this if block.
    <html>
    <head>
    <script type="text/javascript">
    function confirmRemove() {
         var answer = confirm("Are you sure you want to Delete?")
    </script>
    </head>
    <body>
    <form>...

    Hi,
    Back in 2003 I have used an Applet which contain java code and this java code was calling the java scripts ( different methods, DHTML etc..)
    There was a component developed by NetScape called JSObject I am not sure it there is other third party component other then the JSObject
    look at this article which shows how (based on JSObject)
    [http://java.sun.com/products/plugin/1.3/docs/jsobject.html|http://java.sun.com/products/plugin/1.3/docs/jsobject.html]
    Regards,
    Alan Meio
    London,UK

Maybe you are looking for

  • Error in Asset Accounting Message no. GLT2201

    Hi SAP Gurus, We have activated document splitting. WHile posting document in asset accounting through F-90 system showing error "The field Profit Center marked as balancing is not filled with any value in line item 001, even after document splitting

  • How to Determine the window is larger than 1024px  and sotp(2000)

    can i use code on Stage timeline(1000) like: if windows width > 1024px { getStage().stop(2000);} and timeline(2000) add code like : if windows width < 1024px { getStage().stop(1000);} pls help to make it right.thanks. i am very new for this...

  • Editing the document message bar

    I want to change the text in the document message bar to something more helpful. Is there a way to do that?

  • Problems submitting a clob

    Hello, I've a form with three fields that I'm trying to submit to a database table. The third field is displayed as a HTML Editor, and submits to a clob field on the table. Everything works fine when I submit some small amounts of test data, but when

  • Problem accessing ECC 6.0 with Crystal

    Hi, I installed SAP INtegration Kit for BO and the transports etc., Then i tried to access ECC via Crystal 2008. I choose the new connection for 'Sap table, cluster or function" which when connected showing me three groups CL,DD,FN which donot have t