What's the cause of java.lang.UnsatisfiedLinkError in my situation - java

I build a dll with Visual Studio 2008 and it's called by java side throuth jni.
It works fine in A machine but failed in B machine.
The error info is like:
java.lang.UnsatisfiedLinkError:xxx.dll Can't find dependent libraries
The configuration info is like below (The OS and jdk is the same):
A machine:
Win7 64bit;
java version "1.7.0_21" Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) Client VM (build 24.71-b01, mixed mode, sharing)
eclipse-standard-kepler-SR2-win32-x86_64
B machine:
Win7 64bit;
java version "1.7.0_65" Java(TM) SE Runtime Environment (build 1.7.0_65-b19)
Java HotSpot(TM) Client VM (build 24.71-b01, mixed mode, sharing)
eclipse-java-luna-SR1a-win32
The code generation of dll is Multi-threaded Debug (/MTd).
I have no idea about the cause so that please let me know if you need more information to judge the cause.
Thanks for your help in advance.

To find the missed dependency use the Dependency Walker. Open your DDL and it will show you all DDLs it depends on. It will show you also which one could not be found on the current systen.
http://www.dependencywalker.com/

The java.lang.UnsatisfiedLinkError:xxx.dll Can't find dependent libraries is throwed in B machine but not in A machine is because that dll's dependent libraries can't be found by the dll in B machine and to fix it, you can add dependent libraries' path to the environment path. To get the dependent libraries, follow #SubOptimal's suggestion.

Related

Get rid of a jni resolve warning about java.lang.PanwHooks on java.exe startup

Every time I use java.exe, there is this warning:
PowerShell > java -version
[0.052s][warning][jni,resolve] Re-registering of platform native method: java.lang.PanwHooks.NativeMethodEntry(Ljava/lang/Object;ILjava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V from code in a different classloader
java version "18.0.2" 2022-07-19
Java(TM) SE Runtime Environment (build 18.0.2+9-61)
Java HotSpot(TM) 64-Bit Server VM (build 18.0.2+9-61, mixed mode, sharing)
No matter the JDK version. It's the same behavior whether it's jdk1.8.0_211, jdk-11.0.14, jdk-17.0.2 or jdk-18.0.2. Same for OpenJDK 1.8, 11, 17 and 18.
I can not find where is the setting that is used that makes this happen. Any advice will be much appreciated.
The environment is windows 10.
It looks like it's loading a native library on VM startup as well:
[0.009s][info][os ] attempting shared library load of C:\Program Files\Palo Alto Networks\Traps\cyjagent.dll
which looks like a Java agent.
The 'Panw' in PanwHooks seems to stand for Palo Alto Networks, which seems to be an antivirus software. i.e. this antivirus software seems to be injecting a dll which is a java agent, into the JVM process, which then produces this warning.
You should be able to suppress the warning with -Xlog:jni+resolve=off (but I realize that's not ideal).

UnsupportedClassVersionError... but with same JAVA version

I am trying to migrate a tomcat server.
Both are using tomcat7 version and all is supossed to be ready to take my java/jsp files from one server to another.
I did and I got UnsupportedClassVersionError error.
It was normal as in the old one I had JRE 1.8 version and in the new installation I had JRE 1.7 version (both from Oracle).
I proceeded to upgrade the second to 1.8. And everything was fine as in the new the output for java -version is:
java version "1.8.0_191" Java(TM) SE Runtime Environment (build
1.8.0_191-b12) Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode)
While in the old one:
java version "1.8.0_131" Java(TM) SE Runtime Environment (build
1.8.0_131-b11) Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
In both echo $JAVA_HOME outputs:
/usr/lib/jvm/java-8-oracle
I restarted tomcat and server itself... but the UnsupportedClassVersionError persists.
I don't know if:
Somewhere I still point to the JRE 1.7 installation
Or 1.8.0_191 is considered another version than 1.8.0_131
Note: the compiler is the same as they have not been recompiled. Just take the compiled ones from old server (where there is no problem version) to the new one.
Has anyone a hint for me?
Thank you very much
As pointed in comments, sometimes JAVA_HOME is not checked and the decision on what jvm should be used is taken with another criteria (can't say which ones). So removing the old version of java forced the process to choose the desired one as it was unique.

Unable to build Floodlight Controller Package Eclipse

I am working on using Floodlight Controller for SDN. I used
ant eclipse
to setup the Eclipse files and then changed the Build Configuration as desired in the installation instructions. I am getting the following compilation error in the package net.floodlightcontroller.util.MatchUtils:
The method setMasked(MatchField<F>, Masked<F>) in the type Match.Builder is not applicable for the arguments (MatchField, Masked)
on lines 141 and 148.
Can somebody help me with the issue?
Operating System: Mac OS X 10.10
Java Version:
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
As suggested in the comments above, it works with Java SE 1.7. There is also a Github Issue.

Could not create the Java virtual machine OSX10.9

Can't seem to find an answer to this.
If I type java -version I get
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)
I'm trying to run PMD to analyse an iOS project. When I run the command in Terminal however, I get:
Could not create the Java virtual machine.
Anyone have any idea what is causing this?
This could be due to installation issue. Check whether you have installed correct JRE for your platform(bit pattern etc.). If its fine try changing memory settings.
This link will help you to set memory settings in Java

maven2 on ubuntu java home is not defined correctly

I have problem to use maven from ubuntu server 13.10 64bit.
I am getting following error (even when I type mvn -version):
Error: JAVA_HOME is not defined correctly.
We cannot execute /usr/lib/jvm/jdk//bin/java
But when I type java -version I get:
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)
I have no idea where can be the problem, especially because I have used maven without any problems before I've installed hadoop 2.2.
Thank you in advance for any help.
It appears that the Hadoop instructions and/or start up script modifies the JAVA_HOME environment variable in the shell.
Unless this change is made permanent by changing one of the many configuration files - like $HOME/.profile - it only influences the shell in which you have observed the problem.

Categories

Resources