Generating 32 Bit dll JNI - java

Hello im trying to use in a Project a dll generated with JNI.
i generated a 64 Bit dll but my project says %1 is not a valid win32 application
So i decided to generate a new DLL, but this time 32 Bit. I changed the Settings in my Visual Studio like i found i other posts, Configuration to Win32 and Target Machine to MachineX86.
this all works fine but when i try to launch the project with this DLL i get the same error. I checked the DLL with Dependency Walker and found out the DLL is 32Bit, but the included DLL's are 64 Bit.
So you guys are my last hope. Do you have any ideas ?
Notes: i can't change to Linux atm.
Visual Studio 2012
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)

just read it but i already found my error, the problem was that eclipses changes it's installed JRE's when you switch workspace.
so in my testprogramm where i developed my 64bit libary worked. but not in the real project, where the installed JRE was a different one.
so if anyone has the same problem don't forget to check this

Please check your system PATH. Windows will attempt to load the first DLL it finds that matches the DLL's name. Windows doesn't check if the DLL is 32 or 64-bit, it will attempt to load it.
If you built a 32-bit DLL, then you're responsible for making sure that any dependent DLL is also 32-bit, and that Windows finds those 32-bit DLL's first.

Related

Eclipse fails to start, gives - Failed to load the JNI shared Library

I faced this issue many a times while working with a new setup or after a Java upgrade. Logical solution for this? Except replacing jvm.dll file?
Never realized, but the solution is quite easy. As per my understanding:
Observations:
If you are using a 64bit Windows system, then you would notice that there are two Program Files folder in your C:/ Drive.
That means, Program Files, which contains 64-bit programs and applications, and. Program Files (x86), which contains 32-bit programs and applications.
Now if you are using a 64bit system, then it is easy and recommended that you use softwares as well of 64bit. So your Path in System variables should contain the path details of your Java 64bit.
Now coming back to the original problem, here if we are on 64Bit Microsoft Windows system and wish to use 64bit Software (Eclipse for example), then let us set the Path for the 64bit Java.
Then make a simple test on command prompt.
-cmd
-java -version
Shows the 64bit Java VM is set to path.
Now Open your Eclipse and it do not show the Error.
Always remember that we should use:
64 bit OS
64 bit Java (with Path set for 64 bit Java)
64 bit Eclipse.

Suprema BioMini with Java - where should UFLicense.dat be put?

I am working on a fingerprint recognition Java application for a university project.
We bought Suprema Biomini Scanner and SDK and I have installed the SDK on my Windows 8 machine.
I am using Netbeans IDE and I am trying to run the demoUFEJavaJNA.java file.
The GUI for the sample program launches and when I press init, I get the following output with error 101 which means the System has no license.
My UFScanner.dll and UFMatcher.dll are located in my Netbeans project workspace and I have put a copy of UFLicense.dat there as well.
Still the error persists. Any idea how to fix this?
Had the same problem and tried (as the documentation says) to put UFLicense.dat in the same directory of the DLLs, that is, root of where I was developing/debugging, then I put a copy of the DLL and DAT files on C:\Windows\system32 and C:\Windows\SysWOW64, and it worked
NOTE: On System32 you should put the x64 version of the DLLs, while on SysWOW64 the 32 bit version, is a little tricky, but you can check about this on
Why do 64-bit DLLs go to System32 and 32-bit DLLs to SysWoW64 on 64-bit Windows?

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

I have a Problem :D im working on a self generated DLL with JNI.
I have generated the DLL with Visual Studio 2013, for 64Bit machines. I have already checked with Dependency Walker if my DLL is really 64 Bit, and it is. Then i tried to use the DLL in my Java source (Eclipse Version: Luna Service Release 1 (4.4.1) Java Version 1.7.0_71-b14 64 Bit Version).
When i run my Java Programm i get the errormessage Can't load IA 32-bit .dll on a AMD 64-bit platform in this line.
static
{
System.loadLibrary("iomemjava");
}
I have already spend 2 days in this problems and searched stackoverflow and some other forums. I'm really out of Ideas what could possibly be wrong.
So far and in the hope you guys and girls can help
Martin
Java uses the system property java.library.path as the path to find native libraries. When you start your application, define this property on the command line with the -D option and make it point to the directory that contains the DLL. For example:
C:\MyProject> java -Djava.library.path=C:\MyProject\nativelib com.mypackage.MyProgram
where C:\MyProject\nativelib is the directory that contains the DLL you want to use.
go to the link http://www.apache.org/dist/tomcat/tomcat-connectors/native/
find the latest one
download tomcat-native-XXX-win32-bin.zip
open the zip file. find the tcnative-1.dll under X64 folder
finally, replace the .dll in the tomcat bin with the .dll in the zip file

How to run Jcalltracer

Hey guys I'm having trouble opening jcalltracer, an open source program on sourceforge that reverse engineers a Java program into sequence diagram. I got error when I was trying to add the following to JVM -
java -agentpath:C:\calltracer\jvmti\calltracer5.dll=traceFile-C:\calltracer\call.trace,filterFile-C:\calltracer\filters.txt,outputType-xml,usage-uncontrolled -Djava.library.path=C:\calltracer\jvmti -Dcalltracerlib=calltracer5
Error -
Error occured during initialisation of VM
Could not find agent library C:\calltracer\jvmti\calltracer5.dll in absolute path, with error: Can't load IA 32-bit .dll on a AMD 64-bit platform
I am using Windows 7 x64 and I'm very sure that I installed the x64 version after checking the java sdk I downloaded and doing a java -version check. Any clues?
Looks like the calltracer5.dll has been compiled to work on a 32bit platform. You will need to recompile for 64bit.

Java loading library windows 7 64bit

I have a java webstart program, it runs on xp, osx, vista, and windows 7.
I just tried to run it on windows 7 64bit and it is having a problem loading a library.
On this win7x64 machine I have the 64bit jdk/jre and the library it is not loading is swt-win32.dll. Yeah it's 32bit, but I'm getting:
Exception in thread "Thread-10" java.lang.UnsatisfiedLinkError: no swt-win32-3325 or swt-win32 in swt.library.path, java.libary.path or the jar file...
I have tried putting the dll on the java.library.path (physically copying it to the folder) and still get the exact same error. So am I getting this error because it's a 32bit dll or because it actually just can't find it? can the 64bit jdk/jre load/use 32bit dll's or do I need to either find the 64bit version of the dll or run the 32bit jdk/jre?
You have the answer already. 64-bit DLL's require the 64-bit JDK and 32-bit DLL's require the 32-bit JDK.
swt-win32.dll is actually a SWT UI framework(eclipse) dll. Try putting it in a directory which is in your system path.
If that doesn't work, then your next best bet would be to get the SWT binaries for 64 bit windows here. I think it works for windows Vista 64. There is no mention of windows 7 but it "should" work.

Categories