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.


Photo

Loading LJUDJava.dll without admin account

LJUDJava.dll System32 Java

  • Please log in to reply
21 replies to this topic

#1 LJMarco

LJMarco
  • Members
  • 13 posts

Posted 07 August 2013 - 02:01 AM

Dear LabJack-Support,

 

I'm currently trying to work with your LabJack U3-HV (HW-Version 1.30) in combination with Java and the IDE eclipse.

Within my bachelor thesis project I'm currently working with a pc without admin accout which means I cannot copy the

 

 LJUDJava.dll to the C:\Windows\System32\ directory

 

Until now I found no way to load the  LJUDJava.dll from my project directory.

I already added the "LJUDJava.jar" to the project, so I'm "only" having a problem to include the dll.

 

code:

static {
    try {
        System.loadLibrary("C:/workspace/project/LJUDJava/LJUDJava.dll");
    } catch (UnsatisfiedLinkError e) {
        System.err.println("Native code library failed to load.\n" + e);
        System.exit(1);
    }
}

 

error message:

Native code library failed to load.
java.lang.UnsatisfiedLinkError: no C:/workspace/project/LJUDJava/LJUDJava.dll in java.library.path

 

 

Can you please help me with that? :unsure:



#2 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 07 August 2013 - 10:22 AM

If you are using absolute paths to load the dll use System.load instead. System.loadLibrary loads from the Java library path. Depending on your java.library.path settings, you can also put the dll in the same directory as your Java program and use System.loadLibrary("LJUDJava.dll").



#3 LJMarco

LJMarco
  • Members
  • 13 posts

Posted 07 August 2013 - 11:14 PM

Thank you for your fast reply! :rolleyes:

Perfect! Thank you very much, this worked!

 

But now I'm getting the following error: :unsure:

Native code library failed to load.
java.lang.UnsatisfiedLinkError: C:/workspace/project/LJUDJava/LJUDJava.dll: Can't find dependent libraries

This error shows up on both solutions (System.load(...) and System.loadLibrary(...).

 

When working with dependency walker which is recommended to use to fight this error, it also displays errors:

Error: At least one required implicit or forwarded dependency was not found.
Error: At least one module has an unresolved import due to a missing export function in an implicitly dependent module.
Error: Modules with different CPU types were found.
Warning: At least one delay-load dependency module was not found.
Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module.

 

But first of all I think I have to ask you:

I'm working on a Win7 pc (64 bit / Service Pack 1) without admin rights

-> is it possible to connect/run labjack without installing the driver package, just by calling the necessary .jar and .dll's out of the java code?

I spend a lot of time reading your forum and almost all of the problems were solved by

   - installing the driver

   - copying the .dll's to C:\Windows\System32\  or rather  C:\Windows\SysWOW64\

which is both not possible for me.

 

A lot of thanks from a country far away from yours!



#4 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 08 August 2013 - 02:29 PM

You should be able to call the .dlls no matter where they are, as long as your paths are set correctly.  Java might have a special path for .dlls in addition to the normal Windows one.  The .dlls you would need (LabJack specific) are LabJackUD.dll and LabJackWUSB.dll.  Those you should be able to use without admin rights as long as they are somewhere on the system and the paths are set correctly.  You can get them from the system directory on another machine that has the installer.

 

You also need to install the actuall driver for the USB device.  Whether or not that works would depend on how the system is configured.  You can try copying over everything from the Install folder (inside LabJack\Drivers\ folder on the machine the installer was run).  Then attach the LabJack and when it tries to find the driver, point it to where you copied things.  If that works and the above is configured properly you should be able to do things without admin rights.



#5 LJMarco

LJMarco
  • Members
  • 13 posts

Posted 09 August 2013 - 12:40 AM

Your support is really great and fast!

I will try this over the weekend when I will have a pc with administrator privileges and will let you know whether it worked :rolleyes:

 

So, by now: have a nice weekend!



#6 CMReigrut

CMReigrut
  • Members
  • 163 posts

Posted 11 August 2013 - 04:19 PM

Make sure that you're setting your java.library.path environment variable to the location of your DLLs when you start java.

 

For example: java -Djava.library.path=/path/to/dir



#7 LJMarco

LJMarco
  • Members
  • 13 posts

Posted 20 August 2013 - 06:05 AM

Hey there,

sorry for the long working time, but last week was very busy and I had to postpone the Labjack project.

 

The .dlls you would need (LabJack specific) are LabJackUD.dll and LabJackWUSB.dll.  Those you should be able to use without admin rights as long as they are somewhere on the system and the paths are set correctly.  You can get them from the system directory on another machine that has the installer.

 

I added LabJackUD.dll and LabJackWUSB.dll to the LJUDJava - folder after running the installer on my private machine, but Java still displays the same error:

Native code library failed to load.
java.lang.UnsatisfiedLinkError: C:/workspace/project/LJUDJava/LJUDJava.dll: Can't find dependent libraries

Together with your statement

 

You should be able to call the .dlls no matter where they are, as long as your paths are set correctly.  Java might have a special path for .dlls in addition to the normal Windows one. 

 

for me, it seems that the application actually can load the LJUDJava.dll but is still searching for further "dependent libraries" and cannot find them. I also tried this one:

 

Make sure that you're setting your java.library.path environment variable to the location of your DLLs when you start java.

For example: java -Djava.library.path=/path/to/dir

 

 

I added the variable by two different approaches:

After setting the right directory, both approaches caused the same error:

Native code library failed to load.
java.lang.UnsatisfiedLinkError: C:/workspace/project/LJUDJava/LJUDJava.dll: Can't find dependent libraries

----------------------------------------------------------------------------------

 

You also need to install the actuall driver for the USB device.  Whether or not that works would depend on how the system is configured.  You can try copying over everything from the Install folder (inside LabJack\Drivers\ folder on the machine the installer was run).  Then attach the LabJack and when it tries to find the driver, point it to where you copied things.  If that works and the above is configured properly you should be able to do things without admin rights.

 

When I plug in the LabJack U3 there is a small window coming up where I can select the copied driver files. But, when Windows tries to install the driver, it asks for admin rights, which i don't have.

 

----------------------------------------------------------------------------------

 

So, after all, I'm still stuck with the same problems as before :unsure:



#8 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 20 August 2013 - 01:22 PM

It looks like LJUDJava.dll is loading but cannot find the UD driver dlls. Try copying the LabJackUD.dll and LabJackWUSB.dll files to same directory you run your Java program instead. I tried that with one of our examples and it worked.



#9 LJMarco

LJMarco
  • Members
  • 13 posts

Posted 21 August 2013 - 12:51 AM

Yeees, this finally worked, thank you very much!! :lol:

 

-------------------------------------------------------------------------------------------------------------------------

 

But, as always, there is a new error:

UD Driver Version = 3,350
LJUDJava JNI Version = 0,300

Error number = 1007
Error string = LabJack not found
Iteration = 0
Stack Trace :
java.lang.Exception
    at U3SimpleStream.runExample(U3SimpleStream.java:106)
    at U3SimpleStream.main(U3SimpleStream.java:238)

Which refers to the following code:

// Open the first found LabJack U3.
Errorcode = LJUD.OpenLabJack(LJUD.LJ_dtU3, LJUD.LJ_ctUSB, "1", 1, Handle);
ErrorHandler(Errorcode, 0, new Exception());

-------------------------------------------------------------------------------------------------------------------------

 

As first trouble shoots I tried to

  • connect the LabJack to all available USB ports
  • ran other applications (such as U3Simple, U3SimpleStream, Asynch)

 

I also tried to update the firmware, but the LJSelfUprade doesn't run (likely because I wasn't able to install the driver package) and displays one big error message. I will try to get a machine with admin rights during the upcoming hours, update the labjack firmware and will let you know whether this solved the problem.

 

When I look up the U3 in the windows device manager, it is marked with a yellow triangle with an ! in it:

 

n2xp6u23.png

 

So it is found, but it looks like the problem is caused by the missing usb drivers.

Is there a solution for this problem? :wacko:



#10 LJMarco

LJMarco
  • Members
  • 13 posts

Posted 22 August 2013 - 04:49 AM

I updated the firmware this morning, but, as expected, still the same error:

UD Driver Version = 3,350
LJUDJava JNI Version = 0,300

Error number = 1007
Error string = LabJack not found


#11 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 22 August 2013 - 11:38 AM

In the device manager if you right click on the U3 and select "update driver" or something along those lines it should give you that option.  From there it differs on various versions of windows, but you want to specify the driver you want installed.  From there point it to (on a 64-bit system) C:\Program Files (x86)\LabJack\Drivers\Install\LabJacka64.  From there it should see the .inf file and attempt to install the driver.  That process should go smoothly and from that point you should be able to detect the LabJack in your own code or using LJControlPanel.

 

Alternativly, you can try running dpinst64.exe from that same folder (right clicking and selecting "run as administrator"). 

 

If both those methods still don't fix the error (with the yellow ! by the U3) you can try running dpinst64.exe from a command line with the flags  /lm /p /f /sh /
c and sending us the output (either here or to [email protected])



#12 LJMarco

LJMarco
  • Members
  • 13 posts

Posted 22 August 2013 - 12:00 PM

Thank you for the fast reply!

 

In the device manager if you right click on the U3 and select "update driver" or something along those lines it should give you that option.  From there it differs on various versions of windows, but you want to specify the driver you want installed.  From there point it to (on a 64-bit system) C:\Program Files (x86)\LabJack\Drivers\Install\LabJacka64.  From there it should see the .inf file and attempt to install the driver.  That process should go smoothly and from that point you should be able to detect the LabJack in your own code or using LJControlPanel.

 

I already tried this, my main problem is, that I need admin rights in order to install the driver, which I simply don't have on my development machine.

 

 

Alternativly, you can try running dpinst64.exe from that same folder (right clicking and selecting "run as administrator").

 

Same with this, I simply got no admin rights.

 

Is there another option to get rid of the

 

UD Driver Version = 3,350
LJUDJava JNI Version = 0,300

Error number = 1007
Error string = LabJack not found

 

error without admin rights?



#13 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 22 August 2013 - 02:22 PM

The 1007 error is saying that it can't open the device specified.  In your case it looks like you are trying to open any U3 connected to the system.  To do this, the LabJackUD.dll library calls some functions to see which are attached, so that it can communicate with it.

The error is occuring here because the low level driver (that works with Windows to set up & communicate with the hardware) isn't installed, so the LabJackUD.dll library doesn't find any valid devices it can communicate with (none have reached that step).  Without that low level driver installed there isn't a way to communicate with any custom hardware, since Windows simply doesn't know how to do so.  I believe that all hardware drivers being installed require admin access.

 

However, it does not require admin rights to access those drivers, just to install them.  So if you were able to run the above with administrator access, you would only have to do that once, after which everything should work without the administrator rights.



#14 LJMarco

LJMarco
  • Members
  • 13 posts

Posted 26 August 2013 - 01:21 AM

I wanted to develop a java software that can run the LabJack without installing the driver (also because most users of it won't have admin rights). But as you say, unfortunately this is not possible.

I finally got, by the help of a very friendly colleague of mine, the driver installed and everything is working fine so far :rolleyes:

 

So, once again:

Thank you very much for your help and keep doing this great work here!



#15 LJMarco

LJMarco
  • Members
  • 13 posts

Posted 26 August 2013 - 06:29 AM

Hey there,

as the application was working fine within eclipse I exported the code to an executable .jar and tried to run it, which caused following error:

java.lang.UnsatisfiedLinkError: C:\workspace\project\LJUDJava.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform

Sorry for bothering you again, but I tried now for more than 5 hours and can't solve the problem.

 

 

At [http://labjack.com/s...ckud-dll-64-bit] you say:

 

This is an old version of the driver that is no longer necessary. The current LabJack Installer includes both 32-bit and 64-bit versions of everything needed for both 32-bit and 64-bit applications. That installer can be found at this link

 

So, as I finally managed to install the driver package, it should be possible to run the executable .jar, shouldn't it?

I just wonder why it is working fine while I compile it within eclipse, but as soon as I export it, there is this error. I just thought, that it might be connected to the fact that I use the 32bit version of eclipse, but after downloading the 64bit version, there is still the same error.

 

The export seems to be fine, LJUDJava.jar is included.

I simply load the .dll by

	static {
		try {
			System.loadLibrary("/LJUDJava");
		} catch (UnsatisfiedLinkError e) {
			System.err.println("Native code library failed to load.\n" + e);
			JOptionPane.showMessageDialog(null, e);
			System.exit(1);
		}
	}

And place the LJUDJava.dll next to the executable jar.



#16 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 26 August 2013 - 02:09 PM

With 64-bit/32-bit compatibility there are a few pieces that exist.  First, is the low level hardware driver.  This must be 32-bit or 64-bit, matching the OS.  i.e. the 32-bit versions of Windows need the 32-bit version, and the 64-bit version needs the 64-bit.  That part has existed in most versions of our driver.

 

There is also the software piece.  Software can be either 32-bit or 64-bit.  32-bit versions of Windows can only run 32-bit software.  64-bit versions of Windows can run either 32-bit programs or 64-bit programs.  This is dictated by the program itself.  One constraint is that everything for that program (i.e. all .dlls it uses) must match.  So if you have a 32-bit program on a 64-bit version of Windows, it will work fine as long as all the code it is executing is 32-bit.  For the first few iterations of our Installer, we only included the 32-bit version of the LabJackUD.dll, meaning that only 32-bit programs would work nativly.  We did have a 64-bit version of it, for 64-bit programs but it was still being developed/tested so we provided it as a separate download.  However, that 64-bit version of the LabJackUD.dll is now included in the installer, which is why the above link says that separate download is no longer necessary.

 

With Java, there is an additional component to provide Java compatibility, LJUDJava.dll.  This .dll currently only has a 32-bit version.  Thus, your executable (Java) needs to be 32-bit in order to use it.  It's likely that when you are using Eclipse, the Java Runtime being used is 32-bit, which is why it works, but then when you run it outside eclipse, it is using a 64-bit runtime, which is why it gives the error saying the .dll is 32-bit and it is incompatible.

 

It doesn't look like the LJUDJava.dll will be updated to 64-bit.  However, we have been looking at Java support for our LabJackM library, and found a much better (we think) way of doing things in Java.  It's likely we will redo the LabJackUD support for Java using that same method.  We have a little test that we did in the last month that ran under both 32-bit and 64-bit versions of Java just fine.

 

The easiest solution here would be to use 32-bit java to run the application outside Ecilpse.  However, if that isn't possible we can probably get a 64-bit version of the (newer) Java support sometime shortly.  If you are only using a few functions/constants it is probably something we could put together "unofficially" for you pretty quick.  We don't have a full ETA on when an official version would be done, but we hope to include it (along with LabJackM java support, and a number of other new features) in an Installer we hope to release sometime before October.



#17 LJMarco

LJMarco
  • Members
  • 13 posts

Posted 27 August 2013 - 06:39 AM

As always, thank you for this great support!

Just give me a few days to figure out how to handle this topic within this project. :huh:



#18 LJMarco

LJMarco
  • Members
  • 13 posts

Posted 12 September 2013 - 06:14 AM

So, finally I finished my project by using the eclipse IDE to cope with the 32/64 bit problem.

As this application will be used solely on machines with 64-bit JVMs and the users don't have admin rights it's not possible for them to install the 32bit JVM and run the application outside the IDE with the 32 bit LJUDJava.dll.

 

 

If you are only using a few functions/constants it is probably something we could put together "unofficially" for you pretty quick.  We don't have a full ETA on when an official version would be done, but we hope to include it (along with LabJackM java support, and a number of other new features) in an Installer we hope to release sometime before October.

 

In my application I only use things like

  • reading HW/SW - version
  • config one analog channel (-10/+20V)
  • read this information as a stream

-> see: https://forums.labja...?showtopic=6277

So it would be great, if you could put something together for me

 

 

 

And: once again, thank you for the great support! :lol:



#19 FrankGerster

FrankGerster
  • Members
  • 1 posts

Posted 10 October 2013 - 08:21 AM

Hey there,

 

I'm developing a tool in Java which will be used by a bigger number of people. Their machines are pre-configured and use a 64-bit JRE. As they don't have admin rights, I have to cope with the same problem as LJMarco.

 

Is there a final solution for this problem in the meantime?

 

-----------------------------------------------------

 

As far as I can tell my application is okay, but as I try to load LJUDJava.dll, the following error shows up:

Can't load IA 32-bit.dll on a AMD 64-bit platform


#20 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 10 October 2013 - 02:17 PM

I think the method we have for Java support that we gave LJMarco does work.  We haven't had the time to fully flesh it out (adding all the constants and things) but it's certainly usable.  While we don't have time immediately to fully add everything, we could certainly add more constants/functions that you need if any are missing.  If you would like to give it a shot email us at [email protected] and I can send it to you to try.



#21 amit

amit
  • Members
  • 1 posts

Posted 05 February 2014 - 11:46 PM

Dear LabJack-Support,

 

I'm currently trying to work with LabJack U3-HV  in combination with Java and the eclipse IDE towards my final semester project. 

 

It all works fine. LJUDJava.dll gets loaded perfectly. even it works fine when i run my code using IDE but When i try to create the runnable Jar  i get following error... 

 

This operation repacks referenced libraries.

 

Please review the licence associated with libraries you wish to reference to make sure you are able to repack them using this application. Note also that this

Operation does not copy signature files from original libraries to the generated jar file.

 

 

I am using Windows 7 pc (32 bit)

 

 

could you please help ?



#22 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 06 February 2014 - 01:34 PM

This is just a warning message when using the "Extract required libraries into generated jar" library handling. You should be fine with choosing the "OK" option when this message appears, and it will create your jar. As for licensing, you are free to use our provided Java code, jars and dlls, and repack them as you like. We license everything included in our Java download as MIT X11.

 

Alternatively, you can choose the "Package required libraries into generated jar" library handling and this message will not appear.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users