Jump to content

As of July 17, 2015, the LabJack forums here at forums.labjack.com are shut down. New registrations, topics, and replies are disabled. All forums are in a read-only state for archive purposes.

Please visit our current forums at labjack.com/forums to view and make new posts. To post on the current forums, use your labjack.com login account. Your old LabJack forums login credentials have been retired. There are no longer separate logins for labjack.com and LabJack forums.


Windows 64 bit Java compatible LJUDJava.dll?

  • Please log in to reply
4 replies to this topic

#1 jahayes

  • Members
  • 3 posts

Posted 25 May 2012 - 03:34 AM

Hi all,

I have a U3 that I am trying to use embedded into a larger 64-bit Java application on Windows 7 64-bit. Is there a 64-bit compatible LJUDJava.dll available because I cannot seem to find one?

Perhaps to be more precise, I have installed the .dll files from this link (http://labjack.com/s...ckud-dll-64-bit) into the c:\Windows\System32 directory but am getting the following error message when trying to load the LJUDJava.dll from here: http://labjack.com/s...d/examples/java
"LJUDJava.dll: Can't load IA 32-bit .dll on an AMD 64-bit platform"

The latter .dll is loaded fine in a similar application on Windows XP 32-bit. Also, if it's helpful, I am using the 64-bit version of the JDK on the more recent computer and would prefer to not use the 32-bit version, which I expect loads this .dll file just fine even on Windows 7 64-bit.

Thanks for any information anyone has, and best regards,


#2 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 25 May 2012 - 02:54 PM

We only provide a 32-bit version of the LJUDJava.dll which can only be used with 32-bit versions of the UD driver and Java. There are currently no plans for a 64-bit version of LJUDJava.dll, but we are developing a new driver that will have both 32 and 64-bit Java support.

#3 jahayes

  • Members
  • 3 posts

Posted 26 May 2012 - 03:35 AM

Thanks for the response, but I'm a little disappointed to hear that and a bit confused as well. My understanding is that there is a 64-bit UD driver (at least in beta from the link I cited) but the Java->UD bridge is not available to access this driver. First, I take it building this 64-bit compatible LJUDJava.dll is more complicated than simply changing platform target settings and rebuilding within the compiler tools? I'm mainly wondering this because LJUDJava appears to just be a bridge and not accessing the hardware directly. Second though, as a work-around for me, I suppose I should be able to directly load the 64-bit UD driver through JNI and make the native function calls myself from the 64-bit driver? Basically, all I need to do is periodically update the DAC0 and DAC1, but I have to do this from a 64-bit Java application. In that case, the whole UD driver interface does not have to be implemented in Java but only "OpenLabjack", "ePut", "AddRequest", and "GoOne" as specified in LabJackUD.h. I think I should be able to make the last solution work, but if you have any thoughts I would appreciate them. Best, John

#4 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 29 May 2012 - 02:23 PM

LJUDJava is just a wrapper to the UD driver, and the UD driver itself does the hardware interactions. Java adds the the additional requirement of the JNI dll (LJUDJava.dll) that needs to be compatible with 64-bit versions of Java and the UD driver.

You should be able to use the 64-bit version of the UD driver through JNI, and I believe that is the only option to access external dlls in Java. Take a look at SWIG (http://www.swig.org/). It is helpful in generating wrappers to C/C++ dlls in many languages, including Java, and may help to save you some time.

#5 jahayes

  • Members
  • 3 posts

Posted 12 June 2012 - 04:15 AM

Thank you again for the response and the suggestions.

I have used SWIG before to wrap my own code, but unfortunately had difficulty wrapping the LabJack driver. In particular, for some reason a call to OpenLabjack crashes the JVM mysteriously (but some other functions work). So, I'm not sure what the solution is for general Java access to the UD driver right now.

However, the good news is that I was able to write my own JNI wrapper for the 64-bit driver that does what I need. In particular, I wrote a couple accessory functions in C++ that use the LJ 64-bit driver and I can successfully call them from 64-bit Java through JNI now.

I've attached a simple demonstration for posterity if anyone else has need for this type of thing because it was rather complicated to get working.

The details of how to use this were as follows for me on Windows 7 64-bit (as well as on my Intel Mac using Win 7 64-bit running through Parallels 7):

1) Install the 64-bit Labjack driver as specified here: http://labjack.com/s...ckud-dll-64-bit

2) To get some missing .dlls, I had to install this (as detailed in one of the comments of the previous link): http://www.microsoft...s.aspx?id=15336

3) Install the Windows 64-bit JDK 1.6.0_30 (this may work with newer JDKs, but I needed this version): http://www.oracle.co...dk-6u30-oth-JPR

4) I installed Visual C++ Express 2008: http://www.microsoft...ditions/express

5) Then, I had to install this Windows SDK to get the x64 target platform: http://www.microsoft...ls.aspx?id=3138

6) To install the x64 target in the Express editions of VS, I had to follow these instructions, which requires digging into the registry: http://jenshuebel.wo...64-bit-targets/

7) Then, I created the attached solution/project in VC++ 2008. To use the solution on your own computer, you'll need to change the "Additional Include Directories" under the Project Properties|Configuration Properties|C/C++|General to include the SimpleLabjackControl directory that contains the jni.h and jni_md.h files. You may also have to switch off precompiled headers under "C/C++|Precompiled Headers" as well.

After building a Release for the x64 platform, the .dll should be in the "SimpleLabjackControl\x64\Release" directory. I have also included the SimpleLabjackControl.java file in that Release directory that illustrates how to use the JNI functions. Running the file from that directory should result in the DAC0 of the Labjack being set to 1.5 V and DAC1 being set to 4.5 V.

Maybe this info will be helpful for others in the future, and best regards,


Attached Files

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users