• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

There is an incompatible JNA... error (Possible work around)

Offline
#1 dferrier@technologist.com
If this is the error you see then you can try searching for the offending application although it is never clear just where the library is from. I spent some time (hours actually...) trying to track down the cause.

I finally uninstalled all java and then rebooted.

I then did a complete search of the entire C drive looking for any reference to "jna" and then "java" and deleting anything I thought was even remotely connected with that. I then used regedit and scoured the registry for any reference to either of those strings.

I then uninstalled LRTimelapse, rebooted and re-installed from scratch and still the dreaded jna error came up...

So as I was staring at the error for like the 50th time, it dawned on me that Java was just using the PATH to search for things and so out of desperation I tried setting PATH to just the path for the java that ships with LRTimelapse.

And it loaded right up and worked fine.

The fix (at least for me and I suspect for most everyone...) is to set the PATH system variable to only the directory that the LRTimelapse5 executable needs.

You can do this in two ways.

Method ONE:

NOTE: You may not see LRTimelapse.cmd if you navigate to the directory using the windows file explorer if you do not have the option set to display the endings of known file types. You can check by looking at the Type column to see if it is classified as a "Windows command script", if so then this is the right one.

NOTE: good practice would be to right click this file and then select "Copy", then right click and "Paste", in the same directory so that you have a copy of the original in case you mess the editing up and need to start over.

Edit the C:\Program Files\LRTimelapse 5\LRTimelapse.cmd , so you set the PATH variable in that file like this:

Open the file using your favorite text editor, e.g. ultraedit, notepad++, etc..., but do not try to use the generic notepad as it does not handle the line endings properly. You can also try wordpad, although it is not ideal. Anyway you need to add the following to this .cmd file:

set PATH=jre\bin\

And after adding it the complete .cmd file should look like this: (note this is added on line nine of the file)


@echo off
rem --------------------------------------------------------------------
rem Please provide the right path to your javaw.exe here with trailing \
rem The default will use the provided java. If you want to use any other,
rem please provide the right path
rem for example: set java_path="c:\program files (x86)\Java\jre6\bin\"
rem --------------------------------------------------------------------
set java_path=jre\bin\
set PATH=jre\bin\
set memory_usage_min=256m
set memory_usage_max=1024m

rem --------------------------------------------------------------------
rem don't modify underneath this line unless you know what you are doing...
rem --------------------------------------------------------------------

"%java_path%java.exe" -Xms%memory_usage_min% -Xmx%memory_usage_max% -jar LRTimelapse.jar

:CLEANUP
set prog_path=
set java_path=

pause

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

Now save the new version back to the same name.

Try double clicking on the .cmd file and you should see the splash screen and the application should now load.

Method TWO:

Adding a shortcut so that you can run the original windows version without a .cmd batch file.

In the current version of LRTimelapse the windows executable is called: C:\Program Files\LRTimelapse 5\LRTimelapse5.exe

Now navigate to this directory C:\Program Files\LRTimelapse 5\ and right click on the LRTimelapse5.exe and select "Create shortcut".

You will probably not be able to save this directly to the directory as windows does not allow new files to be added there by default. Save it to the desktop or some other convenient location.

Once you have the shortcut saved, navigate to it and right click it and select "Properties".

Now in the target field if you are running the current version of LRTimelapse 5 then you can cut and paste the following line exactly:

C:\Windows\System32\cmd.exe /c "set PATH=jre\bin && start /D ^"C:\Program Files\LRTimelapse 5\^" LRTimelapse5.exe"

If you are running some other version you will have to take note of the differences that might exist and change the path and executable name.

What this does is start up a command line session and sets the PATH variable to what we want and then sets the startup directory (/D option) then lastly starts the actual windows executable.

Save the changes to the shortcut.

Now you can double-click the shortcut you just created and run LRTimelapse as you would normally do.

One or both these methods should provide a way to work around this jna library problem.

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

The root of the problem:

What I believe is happening is that the java environment uses the system PATH as a reference to search for any libraries it is trying to load at runtime. So you notice that by default there are a lot of paths as listed in the error message:

C:\Program Files\LRTimelapse \jre\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\IDM Computer Solutions\UltraEdit;C:\Program Files\IDM Computer Solutions\UltraCompare;C:\Program Files\IDM Computer Solutions\UltraFinder;C:\Program Files\FileBot\;C:\Program Files (x86)\PuTTY\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;..

And this is not the complete system PATH either as denoted by the ending ;...

So anyway what happens is that the java process begins looking for the library starting in the first directory listed in the path and continuing in order each path listed until it finds the one it is looking for by name.

So if the wrong version library is put out there by some other application for its own purposes and Java attempts to load it then sees it is the wrong version, it throws the error.

So by resetting the PATH to only the directory we want Java to look in it always finds what it wants.

That is what I think is happening anyway.

Perhaps Gunther can look into setting the PATH system variable for us upon first invocation of LRTimelapse so that we don't have to worry about some other versions of libraries causing this problem in the future.
Offline
#2 Gunther
Thanks for your ideas! In the windows system settings you can also edit the path setting by yourself. It might be sufficient to add the LRTimelapse location to the very beginning of the path and preserve the other settings.

For a general solution however I would like to avoid altering the path setting, since that is an outdated concept in windows. I'll do some researches, if there is a way to prevent the jna library from using this, since it makes its behavior unpredictable.
Subscribe to: LRTimelapse Newsletter, Youtube Channel, Instagram, Facebook.

...also check out: