Ahmet Ekrem SABAN
asked on
"Could not find or load main class" Java runtime error
Hello!
I am trying to use JNA, but can obviously not see a simple problem. The code is a simple example I got from here. Unfortunately, I got my wires crossed and cannot see where the problem is. I searched the Web and found several sites where a solution is tried to be found for the problem, but no avail. :-(
To reduce the problem to its essentials, I use the command prompt in Windows 8.1 and do the following:
The runtime error reads in English Error: Could not find or load main class, in German Fehler: Hauptklasse HelloWorld konnte nicht gefunden oder geladen werden.
Where do you think I is the problem? As you can see, the code compiles properly.
Thank you in advance!
Hello-JNA-World.png
JNA-Hello-World.PNG
I am trying to use JNA, but can obviously not see a simple problem. The code is a simple example I got from here. Unfortunately, I got my wires crossed and cannot see where the problem is. I searched the Web and found several sites where a solution is tried to be found for the problem, but no avail. :-(
To reduce the problem to its essentials, I use the command prompt in Windows 8.1 and do the following:
D:\Projekte\C>type *
ctest.c
/* ctest.c */
#include <stdio.h>
void helloFromC() {
printf("Hello from C!\n");
}
D:\Projekte\C>gcc -o libctest.so -shared ctest.c
D:\Projekte\C>dir
Datenträger in Laufwerk D: ist Volume
Volumeseriennummer: 0E8C-8BBC
Verzeichnis von D:\Projekte\C
2014-10-22 15:05 <DIR> .
2014-10-22 15:05 <DIR> ..
2014-10-21 16:02 93 ctest.c
2014-10-22 15:05 21.804 libctest.so
2 Datei(en), 21.897 Bytes
2 Verzeichnis(se), 490.275.999.744 Bytes frei
D:\Projekte\C>copy lib*.* ..\Java
libctest.so
..\Java\libctest.so überschreiben? (Ja/Nein/Alle): j
1 Datei(en) kopiert.
D:\Projekte\C>cd ..\Java
D:\Projekte\Java>dir
Datenträger in Laufwerk D: ist Volume
Volumeseriennummer: 0E8C-8BBC
Verzeichnis von D:\Projekte\Java
2014-10-22 15:05 <DIR> .
2014-10-22 15:05 <DIR> ..
2014-10-22 13:20 354 HelloWorld.java
2014-10-21 16:50 946.973 jna-3.2.5.jar
2014-10-22 15:05 21.804 libctest.so
3 Datei(en), 969.131 Bytes
2 Verzeichnis(se), 490.275.999.744 Bytes frei
D:\Projekte\Java>type HelloWorld.java
/* Hello World! */
import com.sun.jna.Library;
import com.sun.jna.Native;
public class HelloWorld {
public interface CTest extends Library {
public void helloFromC();
}
static public void main(String argv[]) {
CTest ctest = (CTest) Native.loadLibrary("ctest", CTest.class);
ctest.helloFromC();
}
}
D:\Projekte\Java>javac -classpath jna-3.2.5.jar HelloWorld.java
D:\Projekte\Java>java -classpath jna-3.2.5.jar:. HelloWorld
Fehler: Hauptklasse HelloWorld konnte nicht gefunden oder geladen werden
D:\Projekte\Java>
The runtime error reads in English Error: Could not find or load main class, in German Fehler: Hauptklasse HelloWorld konnte nicht gefunden oder geladen werden.
Where do you think I is the problem? As you can see, the code compiles properly.
Thank you in advance!
Hello-JNA-World.png
JNA-Hello-World.PNG
Probably your classpath isn't set correctly.
Wrong path separator - in Windows it's ';'D:\Projekte\Java>java -classpath jna-3.2.5.jar:. HelloWorld
ASKER
Thank you for your replies! I can compile other Java files without problems. The Java file of interest uses JNA. This must be the cause of the problem, but the library I use contains the native elements.
I changed the separator from a colon to a semicolon and got another error message:
However, libctest.o does include ctest.
I changed the separator from a colon to a semicolon and got another error message:
D:\Projekte\Java>java -classpath jna-3.2.5.jar;. HelloWorld
Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load librar
y 'ctest': Das angegebene Modul wurde nicht gefunden.
at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:164)
at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:237)
at com.sun.jna.Library$Handler.<init>(Library.java:140)
at com.sun.jna.Native.loadLibrary(Native.java:375)
at com.sun.jna.Native.loadLibrary(Native.java:360)
at HelloWorld.main(HelloWorld.java:11)
D:\Projekte\Java>
However, libctest.o does include ctest.
ctest is meant to be a String, isn't it? You seem to be using a CTest there.
ASKER
Personally, I just copied the example found in the Web... I do not mean something special; this seems to be the correct way to write it down I suppose.
I think you might have your naming wrong. Try following this closely:
http://m-hewedy.blogspot.co.uk/2011/08/java-native-access-jna-by-example.html
http://m-hewedy.blogspot.co.uk/2011/08/java-native-access-jna-by-example.html
Before that, you can try
D:\Projekte\Java>java -Djna.library.path=. -classpath jna-3.2.5.jar;. HelloWorld
ASKER
The line of code you send to execute before gives the same error message.
I tried the other example and got the following:
I tried the other example and got the following:
D:\Projekte\Java>type Test.java
import com.sun.jna.Library;
import com.sun.jna.Native;
public class Test {
public interface Add extends Library
{
Add INSTANCE = (Add) Native.loadLibrary("add", Add.class);
int add(int x, int y);
}
public static void main(String[] args) {
Add lib = Add.INSTANCE;
System.out.println(lib.add(10, 20));
}
}
D:\Projekte\Java>javac -classpath jna-3.2.5.jar Test.java
D:\Projekte\Java>java -classpath jna-3.2.5.jar;. Test
Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load librar
y 'add': Das angegebene Modul wurde nicht gefunden.
at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:164)
at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:237)
at com.sun.jna.Library$Handler.<init>(Library.java:140)
at com.sun.jna.Native.loadLibrary(Native.java:375)
at com.sun.jna.Native.loadLibrary(Native.java:360)
at Test$Add.<clinit>(Test.java:7)
at Test.main(Test.java:11)
D:\Projekte\Java>
Have you checked the directory into which the header file went?
You compiled with g++ exactly as per the example?
btw i noticed you were compiled a shared object (.so). If you're using Windows, you should be compiling a DLL
ASKER
Hi, krakatoa! I can't see any header files of my own:
And hi CEHJ! I use gcc of MinGW. Although I use now a DLL, I unfortunately still have the same problem.
D:\projects>dir C Java
Datenträger in Laufwerk D: ist Volume
Volumeseriennummer: 0E8C-8BBC
Verzeichnis von D:\projects\C
2014-10-22 16:55 <DIR> .
2014-10-22 16:55 <DIR> ..
2014-10-22 16:55 49 add.c
2014-10-22 16:55 21.582 add.dll
2014-10-21 16:02 93 ctest.c
2014-10-22 16:41 766 ctest.o
2014-10-22 16:42 21.804 libctest.dll
5 Datei(en), 44.294 Bytes
Verzeichnis von D:\projects\Java
2014-10-22 16:59 <DIR> .
2014-10-22 16:59 <DIR> ..
2014-10-22 16:55 21.582 add.dll
2014-10-22 16:44 216 HelloWorld$CTest.class
2014-10-22 16:44 495 HelloWorld.class
2014-10-22 13:20 354 HelloWorld.java
2014-10-21 16:50 946.973 jna-3.2.5.jar
2014-10-22 16:42 21.804 libctest.dll
2014-10-22 16:59 434 Test$Add.class
2014-10-22 16:59 508 Test.class
2014-10-22 17:01 332 Test.java
9 Datei(en), 992.698 Bytes
2 Verzeichnis(se), 490.275.942.400 Bytes frei
D:\projects>
And hi CEHJ! I use gcc of MinGW. Although I use now a DLL, I unfortunately still have the same problem.
I tried the other example and got the following:
Try instead
D:\Projekte\Java>java -Djna.library.path=. -classpath jna-3.2.5.jar;. Test
Otherwise, you might have a bitness problem. Make sure you're compiling and running a 64-bit dll if you have a 64 bit machine
ASKER
Oh!!! :-o How can I find out whether the generated DLL is 32- or 64-bit?? You mean that a 64-bit system cannot read a 32-bit library, do you? Actually, I see a mingw32-cc.exe file and others starting with mingw32 in the MinGW bin directory. But there are also other similarly-named files, where this "prefix" is missing. Currently, I do not use them with the "prefix".
Try
and post the result
objbump -p add.dll
and post the result
ASKER
Here you go…
objdump.txt
objdump.txt
OK that at least shows that you have 32 bit dlls. This could give a bit more info:
D:\Projekte\Java>java -Djna.library.path=. -Djna.debug_load.jna=true -Djna.debug_load=true -classpath jna-3.2.5.jar;. Test
ASKER
Yes, this is the result:
D:\projects\Java>java -Djna.library.path=. -Djna.debug_load.jna=true -Djna.debug_load=true -classpath jna-3.2.5.jar;. Test
Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load librar
y 'add': Das angegebene Modul wurde nicht gefunden.
at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:164)
at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:237)
at com.sun.jna.Library$Handler.<init>(Library.java:140)
at com.sun.jna.Native.loadLibrary(Native.java:375)
at com.sun.jna.Native.loadLibrary(Native.java:360)
at Test$Add.<clinit>(Test.java:7)
at Test.main(Test.java:11)
D:\projects\Java>
None of those debug parameters worked - that's odd
You said earlier that you couldn't find the header file - or any of 'your' header files at least. Shouldn't you be concerned about that?
ASKER
Well, I have written only a very short C files that do not have any header files of their own. Actually, I do not have any header files of my own & therefore not concerned about that. :-s
Since you have it installed, I would try to get your example running under Cygwin first.
Think I see it. libctest.dll should be called ctest.dll (the lib prefix is a Linux thing)
Also it needs to be in a folder in your PATH (CLASSPATH will not do).
ASKER
Well, I do not think that Cygwin is installed here. At least, I searched the C drive and couldn't find it. Also, the only 'Cygwin' word in this question is in your comment.
"It" lies in the folder of compilation, if you mean the newly relabeled file ctest.dll. So, it is actually on the first item '.' in the path. To make it clear what I've done, here is the code:
"It" lies in the folder of compilation, if you mean the newly relabeled file ctest.dll. So, it is actually on the first item '.' in the path. To make it clear what I've done, here is the code:
D:\projects\C>gcc -o ctest.dll -shared ctest.c
D:\projects\C>dir
Datenträger in Laufwerk D: ist Volume
Volumeseriennummer: 0E8C-8BBC
Verzeichnis von D:\projects\C
2014-11-12 09:18 <DIR> .
2014-11-12 09:18 <DIR> ..
2014-10-22 15:55 49 add.c
2014-10-22 15:55 21.582 add.dll
2014-10-21 15:02 93 ctest.c
2014-11-12 09:18 21.804 ctest.dll
4 Datei(en), 43.528 Bytes
2 Verzeichnis(se), 490.275.897.344 Bytes frei
D:\projects\C>copy *.dll ..\Java
add.dll
..\Java\add.dll überschreiben? (Ja/Nein/Alle): a
ctest.dll
2 Datei(en) kopiert.
D:\projects\C>cd ..\Java
D:\projects\Java>dir
Datenträger in Laufwerk D: ist Volume
Volumeseriennummer: 0E8C-8BBC
Verzeichnis von D:\projects\Java
2014-11-12 09:19 <DIR> .
2014-11-12 09:19 <DIR> ..
2014-10-22 15:55 21.582 add.dll
2014-11-12 09:18 21.804 ctest.dll
2014-10-22 15:44 216 HelloWorld$CTest.class
2014-10-22 15:44 495 HelloWorld.class
2014-10-22 12:20 354 HelloWorld.java
2014-10-21 15:50 946.973 jna-3.2.5.jar
2014-10-22 15:42 21.804 libctest.dll
2014-10-23 13:19 17.286 objdump.txt
2014-10-23 11:46 3.819 sorted.txt
2014-10-22 15:59 434 Test$Add.class
2014-10-22 15:59 508 Test.class
2014-10-22 16:01 332 Test.java
12 Datei(en), 1.035.607 Bytes
2 Verzeichnis(se), 490.275.872.768 Bytes frei
D:\projects\Java>javac -classpath jna-3.2.5.jar HelloWorld.java
D:\projects\Java>java -classpath jna-3.2.5.jar:. HelloWorld
Fehler: Hauptklasse HelloWorld konnte nicht gefunden oder geladen werden
D:\projects\Java>
I wouldn't trust "." in PATH. You never know what Java might be doing - it could have changed directory and only taken care of CLASSPATH. I would either explicitly add your folder to the PATH or copy ctest.dll to some folder already on the PATH (e.g. C\:\WINDOWS) (temporarily, of course;)
ASKER
Thank you for your help! I have done it and here is the result…
Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. Alle Rechte vorbehalten.
C:\Windows\system32>CD /D %PROJECTS%/Java
D:\projects\Java>dir
Datenträger in Laufwerk D: ist Volume
Volumeseriennummer: 0E8C-8BBC
Verzeichnis von D:\projects\Java
2014-11-12 09:19 <DIR> .
2014-11-12 09:19 <DIR> ..
2014-10-22 15:55 21.582 add.dll
2014-11-12 09:18 21.804 ctest.dll
2014-11-12 09:23 216 HelloWorld$CTest.class
2014-11-12 09:23 495 HelloWorld.class
2014-10-22 12:20 354 HelloWorld.java
2014-10-21 15:50 946.973 jna-3.2.5.jar
2014-10-22 15:42 21.804 libctest.dll
2014-10-23 13:19 17.286 objdump.txt
2014-10-23 11:46 3.819 sorted.txt
2014-10-22 15:59 434 Test$Add.class
2014-10-22 15:59 508 Test.class
2014-10-22 16:01 332 Test.java
12 Datei(en), 1.035.607 Bytes
2 Verzeichnis(se), 490.275.872.768 Bytes frei
D:\projects\Java>PATH
PATH=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32
\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Windows Kits\8.1\Windows Perform
ance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program F
iles (x86)\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files\Microsoft SQL S
erver\110\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\M
anagementStudio\;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE
\PrivateAssemblies\;C:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn\;C:
\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Java\jdk1.8
.0_05\bin;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\;C:\MinGW\bin;C:\
MinGW\mingw32\bin;.;c:\Program Files\Saxonica\SaxonHE9.4N\bin;D:\projects\Java
D:\projects\Java>PATH | FIND "D:\projects\Java"
PATH=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32
\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Windows Kits\8.1\Windows Perform
ance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program F
iles (x86)\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files\Microsoft SQL S
erver\110\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\M
anagementStudio\;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE
\PrivateAssemblies\;C:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn\;C:
\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Java\jdk1.8
.0_05\bin;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\;C:\MinGW\bin;C:\
MinGW\mingw32\bin;.;c:\Program Files\Saxonica\SaxonHE9.4N\bin;D:\projects\Java
D:\projects\Java>java jna-3.2.5.jar:. HelloWorld
Fehler: Hauptklasse jna-3.2.5.jar:. konnte nicht gefunden oder geladen werden
D:\projects\Java>java -classpath jna-3.2.5.jar:. HelloWorld
Fehler: Hauptklasse HelloWorld konnte nicht gefunden oder geladen werden
D:\projects\Java>
is not a valid command in any wayD:\projects\Java>java jna-3.2.5.jar:. HelloWorld
Would be a valid command, but the path separator in Windows is the semicolon, not colonD:\projects\Java>java -classpath jna-3.2.5.jar:. HelloWorld
ASKER
Here are the commands with a semicolon:
D:\projects\Java>java jna-3.2.5.jar;. HelloWorld
Fehler: Hauptklasse jna-3.2.5.jar;. konnte nicht gefunden oder geladen werden
D:\projects\Java>java -classpath jna-3.2.5.jar;. HelloWorld
Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load librar
y 'ctest':
at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:164)
at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:237)
at com.sun.jna.Library$Handler.<init>(Library.java:140)
at com.sun.jna.Native.loadLibrary(Native.java:375)
at com.sun.jna.Native.loadLibrary(Native.java:360)
at HelloWorld.main(HelloWorld.java:11)
D:\projects\Java>
Well, i told you the first command was not valid in any way so putting in a semicolon was pointless ;)
Try the following
(that assumes ctest.dll is in that directory)
Try the following
D:\projects\Java>java -Djava.library.path=. -classpath jna-3.2.5.jar;. HelloWorld
(that assumes ctest.dll is in that directory)
ASKER
Here you go!
D:\projects\Java>java -Djava.library.path=. -classpath jna-3.2.5.jar;. HelloWorl
d
Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load librar
y 'ctest':
at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:164)
at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:237)
at com.sun.jna.Library$Handler.<init>(Library.java:140)
at com.sun.jna.Native.loadLibrary(Native.java:375)
at com.sun.jna.Native.loadLibrary(Native.java:360)
at HelloWorld.main(HelloWorld.java:11)
D:\projects\Java>dir
Datenträger in Laufwerk D: ist Volume
Volumeseriennummer: 0E8C-8BBC
Verzeichnis von D:\projects\Java
2014-11-12 09:19 <DIR> .
2014-11-12 09:19 <DIR> ..
2014-10-22 15:55 21.582 add.dll
2014-11-12 09:18 21.804 ctest.dll
2014-11-12 09:23 216 HelloWorld$CTest.class
2014-11-12 09:23 495 HelloWorld.class
2014-10-22 12:20 354 HelloWorld.java
2014-10-21 15:50 946.973 jna-3.2.5.jar
2014-10-22 15:42 21.804 libctest.dll
2014-10-23 13:19 17.286 objdump.txt
2014-10-23 11:46 3.819 sorted.txt
2014-10-22 15:59 434 Test$Add.class
2014-10-22 15:59 508 Test.class
2014-10-22 16:01 332 Test.java
12 Datei(en), 1.035.607 Bytes
2 Verzeichnis(se), 490.275.872.768 Bytes frei
D:\projects\Java>
Can you please post the code that handles ctest.dll?
ASKER
D:\projects\Java>cd ..\C
D:\projects\C>dir
Datenträger in Laufwerk D: ist Volume
Volumeseriennummer: 0E8C-8BBC
Verzeichnis von D:\projects\C
2014-11-12 09:18 <DIR> .
2014-11-12 09:18 <DIR> ..
2014-10-22 15:55 49 add.c
2014-10-22 15:55 21.582 add.dll
2014-10-21 15:02 93 ctest.c
2014-11-12 09:18 21.804 ctest.dll
4 Datei(en), 43.528 Bytes
2 Verzeichnis(se), 490.275.872.768 Bytes frei
D:\projects\C>type ctest.c
/* ctest.c */
#include <stdio.h>
void helloFromC() {
printf("Hello from C!\n");
}
D:\projects\C>gcc -o ctest.dll -shared ctest.c
D:\projects\C>dir
Datenträger in Laufwerk D: ist Volume
Volumeseriennummer: 0E8C-8BBC
Verzeichnis von D:\projects\C
2014-11-12 12:54 <DIR> .
2014-11-12 12:54 <DIR> ..
2014-10-22 15:55 49 add.c
2014-10-22 15:55 21.582 add.dll
2014-10-21 15:02 93 ctest.c
2014-11-12 12:54 21.804 ctest.dll
4 Datei(en), 43.528 Bytes
2 Verzeichnis(se), 490.275.872.768 Bytes frei
D:\projects\C>
ctest.c
Actually i meant the Java code. Can i see that please?
Since the binary you're dealing with is in another directory, you would be better doing
Since the binary you're dealing with is in another directory, you would be better doing
D:\projects\Java>java -Djava.library.path=..\C -classpath jna-3.2.5.jar;. HelloWorld
ASKER
Yes, of course!
D:\projects\Java>java -Djava.library.path=..\C -classpath jna-3.2.5.jar;. HelloW
orld
Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load librar
y 'ctest':
at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:164)
at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:237)
at com.sun.jna.Library$Handler.<init>(Library.java:140)
at com.sun.jna.Native.loadLibrary(Native.java:375)
at com.sun.jna.Native.loadLibrary(Native.java:360)
at HelloWorld.main(HelloWorld.java:11)
D:\projects\Java>dir
Datenträger in Laufwerk D: ist Volume
Volumeseriennummer: 0E8C-8BBC
Verzeichnis von D:\projects\Java
2014-11-12 12:59 <DIR> .
2014-11-12 12:59 <DIR> ..
2014-10-22 15:55 21.582 add.dll
2014-11-12 09:18 21.804 ctest.dll
2014-11-12 09:23 216 HelloWorld$CTest.class
2014-11-12 09:23 495 HelloWorld.class
2014-10-22 12:20 354 HelloWorld.java
2014-10-21 15:50 946.973 jna-3.2.5.jar
2014-10-22 15:42 21.804 libctest.dll
2014-10-22 15:59 434 Test$Add.class
2014-10-22 15:59 508 Test.class
2014-10-22 16:01 332 Test.java
10 Datei(en), 1.014.502 Bytes
2 Verzeichnis(se), 490.275.897.344 Bytes frei
D:\projects\Java>
HelloWorld.java
It's conceivable it doesn't like relative paths and you could be missing a jar, so try (after getting those jars from https://github.com/twall/jna )
D:\projects\Java>java -Djna.library.path=D:\projects\C -classpath jna-4.1.0.jar;jna-platform-4.1.0.jar;. HelloWorld
ASKER
I never used jna-4.1.0.jar. I have jna-3.2.5.jar instead in the same directory, as you can see above.
You didn't read my posting carefully enough:
so try (after getting those jars from https://github.com/twall/jna )
ASKER
D:\projects\Java>java -Djava.library.path=..\C -classpath jna-platform-4.1.0.jar
;. HelloWorld
Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/jna/Library
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at HelloWorld.main(HelloWorld.java:11)
Caused by: java.lang.ClassNotFoundException: com.sun.jna.Library
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 13 more
D:\projects\Java>dir
Datenträger in Laufwerk D: ist Volume
Volumeseriennummer: 0E8C-8BBC
Verzeichnis von D:\projects\Java
2014-11-12 15:07 <DIR> .
2014-11-12 15:07 <DIR> ..
2014-10-22 15:55 21.582 add.dll
2014-11-12 09:18 21.804 ctest.dll
2014-11-12 09:23 216 HelloWorld$CTest.class
2014-11-12 09:23 495 HelloWorld.class
2014-10-22 12:20 354 HelloWorld.java
2014-10-21 15:50 946.973 jna-3.2.5.jar
2014-11-12 15:06 1.464.423 jna-platform-4.1.0.jar
2014-10-22 15:42 21.804 libctest.dll
2014-10-22 15:59 434 Test$Add.class
2014-10-22 15:59 508 Test.class
2014-10-22 16:01 332 Test.java
11 Datei(en), 2.478.925 Bytes
2 Verzeichnis(se), 490.274.430.976 Bytes frei
D:\projects\Java>
Again, you didn't read my posting carefully enough. That's not the command i gave you
ASKER
Sorry! I copied your comment you posted at 2014-11-12 at 14:16:07 now and got the following result:
D:\projects\Java>dir
Datenträger in Laufwerk D: ist Volume
Volumeseriennummer: 0E8C-8BBC
Verzeichnis von D:\projects\Java
2014-11-12 15:07 <DIR> .
2014-11-12 15:07 <DIR> ..
2014-10-22 15:55 21.582 add.dll
2014-11-12 09:18 21.804 ctest.dll
2014-11-12 09:23 216 HelloWorld$CTest.class
2014-11-12 09:23 495 HelloWorld.class
2014-10-22 12:20 354 HelloWorld.java
2014-10-21 15:50 946.973 jna-3.2.5.jar
2014-11-12 15:06 1.464.423 jna-platform-4.1.0.jar
2014-10-22 15:42 21.804 libctest.dll
2014-10-22 15:59 434 Test$Add.class
2014-10-22 15:59 508 Test.class
2014-10-22 16:01 332 Test.java
11 Datei(en), 2.478.925 Bytes
2 Verzeichnis(se), 490.274.430.976 Bytes frei
D:\projects\Java>java -Djna.library.path=D:\projects\C -classpath jna-4.1.0.jar;
jna-platform-4.1.0.jar;. HelloWorld
Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/jna/Library
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at HelloWorld.main(HelloWorld.java:11)
Caused by: java.lang.ClassNotFoundException: com.sun.jna.Library
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 13 more
D:\projects\Java>
Output, please, of
?
D:\projects\Java>jar tf jna-4.1.0.jar
?
ASKER
D:\projects\Java>jar tf jna-4.1.0.jar
java.io.FileNotFoundException: jna-4.1.0.jar (Das System kann die angegebene Dat
ei nicht finden)
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:220)
at java.util.zip.ZipFile.<init>(ZipFile.java:150)
at java.util.zip.ZipFile.<init>(ZipFile.java:121)
at sun.tools.jar.Main.list(Main.java:1060)
at sun.tools.jar.Main.run(Main.java:291)
at sun.tools.jar.Main.main(Main.java:1233)
D:\projects\Java>DIR
Datenträger in Laufwerk D: ist Volume
Volumeseriennummer: 0E8C-8BBC
Verzeichnis von D:\projects\Java
2014-11-12 15:07 <DIR> .
2014-11-12 15:07 <DIR> ..
2014-10-22 15:55 21.582 add.dll
2014-11-12 09:18 21.804 ctest.dll
2014-11-12 09:23 216 HelloWorld$CTest.class
2014-11-12 09:23 495 HelloWorld.class
2014-10-22 12:20 354 HelloWorld.java
2014-10-21 15:50 946.973 jna-3.2.5.jar
2014-11-12 15:06 1.464.423 jna-platform-4.1.0.jar
2014-10-22 15:42 21.804 libctest.dll
2014-10-22 15:59 434 Test$Add.class
2014-10-22 15:59 508 Test.class
2014-10-22 16:01 332 Test.java
11 Datei(en), 2.478.925 Bytes
2 Verzeichnis(se), 490.274.430.976 Bytes frei
D:\projects\Java>
Again you didn't follow my instructions and get BOTH jars
ASKER
Sorry again! This time, a long list appears:
D:\projects\Java>jar tf jna-platform-4.1.0.jar
[…]
com/sun/jna/platform/win32/WinUser$WNDENUMPROC.class
com/sun/jna/platform/win32/WinUser$WindowProc.class
com/sun/jna/platform/win32/WinUser.class
com/sun/jna/platform/win32/Winioctl$STORAGE_DEVICE_NUMBER$ByReference.class
com/sun/jna/platform/win32/Winioctl$STORAGE_DEVICE_NUMBER.class
com/sun/jna/platform/win32/Winioctl.class
com/sun/jna/platform/win32/Winspool$PRINTER_INFO_1.class
com/sun/jna/platform/win32/Winspool$PRINTER_INFO_4.class
com/sun/jna/platform/win32/Winspool.class
com/sun/jna/platform/win32/WinspoolUtil.class
com/sun/jna/platform/win32/Winsvc$SC_HANDLE.class
com/sun/jna/platform/win32/Winsvc$SC_STATUS_TYPE.class
com/sun/jna/platform/win32/Winsvc$SERVICE_STATUS.class
com/sun/jna/platform/win32/Winsvc$SERVICE_STATUS_PROCESS.class
com/sun/jna/platform/win32/Winsvc.class
com/sun/jna/platform/win32/Wtsapi32.class
com/sun/jna/platform/win32/package.html
com/sun/jna/platform/wince/CoreDLL.class
D:\projects\Java>dir
Datenträger in Laufwerk D: ist Volume
Volumeseriennummer: 0E8C-8BBC
Verzeichnis von D:\projects\Java
2014-11-13 13:39 <DIR> .
2014-11-13 13:39 <DIR> ..
2014-10-22 15:55 21.582 add.dll
2014-11-12 09:18 21.804 ctest.dll
2014-11-12 09:23 216 HelloWorld$CTest.class
2014-11-12 09:23 495 HelloWorld.class
2014-10-22 12:20 354 HelloWorld.java
2014-11-12 15:06 1.464.423 jna-platform-4.1.0.jar
2014-10-22 15:42 21.804 libctest.dll
2014-10-22 15:59 434 Test$Add.class
2014-10-22 15:59 508 Test.class
2014-10-22 16:01 332 Test.java
10 Datei(en), 1.531.952 Bytes
2 Verzeichnis(se), 490.275.381.248 Bytes frei
D:\projects\Java>
You are still not reading my replies properly, so you're wasting my time and yours. sae1962at, this is your LAST warning.
ASKER
D:\projects\Java>java -Djna.library.path=D:\projects\C -classpath jna-4.1.0.jar;
jna-platform-4.1.0.jar;. HelloWorld
Fehler: Hauptklasse jna-platform-4.1.0.jar;. konnte nicht gefunden oder geladen
werden
D:\projects\Java>dir
Datenträger in Laufwerk D: ist Volume
Volumeseriennummer: 0E8C-8BBC
Verzeichnis von D:\projects\Java
2014-11-13 13:58 <DIR> .
2014-11-13 13:58 <DIR> ..
2014-10-22 15:55 21.582 add.dll
2014-11-12 09:18 21.804 ctest.dll
2014-11-12 09:23 216 HelloWorld$CTest.class
2014-11-12 09:23 495 HelloWorld.class
2014-10-22 12:20 354 HelloWorld.java
2014-11-13 13:58 914.597 jna-4.1.0.jar
2014-11-12 15:06 1.464.423 jna-platform-4.1.0.jar
2014-10-22 15:42 21.804 libctest.dll
2014-10-22 15:59 434 Test$Add.class
2014-10-22 15:59 508 Test.class
2014-10-22 16:01 332 Test.java
11 Datei(en), 2.446.549 Bytes
2 Verzeichnis(se), 490.274.463.744 Bytes frei
D:\projects\Java>
D:\projects\Java>java -Djna.library.path=D:\projects\C -classpath jna-4.1.0.jar;jna-platform-4.1.0.jar;. HelloWorld
ASKER
Here, you go…
Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. Alle Rechte vorbehalten.
C:\Windows\system32>CD /D %PROJECTS%
D:\projects>cd Java
D:\projects\Java>DIR
Datenträger in Laufwerk D: ist Volume
Volumeseriennummer: 0E8C-8BBC
Verzeichnis von D:\projects\Java
2014-11-13 14:03 <DIR> .
2014-11-13 14:03 <DIR> ..
2014-10-22 15:55 21.582 add.dll
2014-11-12 09:18 21.804 ctest.dll
2014-11-12 09:23 216 HelloWorld$CTest.class
2014-11-12 09:23 495 HelloWorld.class
2014-10-22 12:20 354 HelloWorld.java
2014-11-13 13:58 914.597 jna-4.1.0.jar
2014-11-12 15:06 1.464.423 jna-platform-4.1.0.jar
2014-10-22 15:42 21.804 libctest.dll
2014-10-22 15:59 434 Test$Add.class
2014-10-22 15:59 508 Test.class
2014-10-22 16:01 332 Test.java
11 Datei(en), 2.446.549 Bytes
2 Verzeichnis(se), 490.274.463.744 Bytes frei
D:\projects\Java>java -Djna.library.path=D:\projects\C -classpath jna-4.1.0.jar;
jna-platform-4.1.0.jar;. HelloWorld
Exception in thread "main" java.lang.UnsatisfiedLinkError: %1 ist keine zulässig
e Win32-Anwendung.
at com.sun.jna.Native.open(Native Method)
at com.sun.jna.Native.open(Native.java:1759)
at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:260)
at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:398)
at com.sun.jna.Library$Handler.<init>(Library.java:147)
at com.sun.jna.Native.loadLibrary(Native.java:412)
at com.sun.jna.Native.loadLibrary(Native.java:391)
at HelloWorld.main(HelloWorld.java:11)
D:\projects\Java>
See http://de.kioskea.net/faq/1005-win-32-fehler-beheben#simili_main
Also you might need to recompile that dll and pay attention to the loading of 64/32 binaries
Also you might need to recompile that dll and pay attention to the loading of 64/32 binaries
Well here's a strange thing: I don't have Windows but I downloaded jna-4.10 to my Linux system. And everything you posted just worked!
Actually I don't think I need the com symlink - that was an earlier attempt to compile HelloWorld.java.
21:03:09$ ls -l
total 12
-rw-r--r-- 1 dunc users 354 Nov 15 18:41 HelloWorld.java
-rw-r--r-- 1 dunc users 106 Nov 15 21:02 build
lrwxrwxrwx 1 dunc users 18 Nov 15 20:43 com -> /tmp/jna-4.1.0/com
-rw-r--r-- 1 dunc users 93 Nov 15 20:50 ctest.c
lrwxrwxrwx 1 dunc users 27 Nov 15 18:44 jna.jar -> /tmp/jna-4.1.0/dist/jna.jar
21:03:22$ cat build
javac -cp jna.jar HelloWorld.java
gcc -shared ctest.c -o libctest.so
CLASSPATH=jna.jar:. java HelloWorld
21:04:16$ . build
Hello from C!
The FAQ at github says
set the system property jna.debug_load=true, and JNA will print its library search steps to the console.I would try this, but I don't know how to set system properties.
jna.debug_load.jna will trace the search for JNA's own native support.
Actually I don't think I need the com symlink - that was an earlier attempt to compile HelloWorld.java.
Thanks for that. I tried it
The setting shows how java looks for the java class library but not how it looks for the native one. I was surprised that it found the native library, guess it looks along the class path.
Adding -Djna.library.path=. as you suggested in http:#a40399283 made no difference.
00:44:28$ CLASSPATH=jna.jar:. java -Djna.debug_load.jna=true HelloWorld
Trying (via loadLibrary) jnidispatch
Looking in classpath from sun.misc.Launcher$AppClassLoader@139a55 for /com/sun/jna/linux-x86/libjnidispatch.so
Found library resource at jar:file:/tmp/jna-4.1.0/dist/jna.jar!/com/sun/jna/linux-x86/libjnidispatch.so
Trying /tmp/jna-3095046/jna36740228387306000.tmp
Found jnidispatch at /tmp/jna-3095046/jna36740228387306000.tmp
Hello from C!
The setting shows how java looks for the java class library but not how it looks for the native one. I was surprised that it found the native library, guess it looks along the class path.
Adding -Djna.library.path=. as you suggested in http:#a40399283 made no difference.
Because this is Linux, I could use strace
01:23:22$ strace -e \!clock_gettime,sched_getaffinity,futex,gettimeofday,read,getdents64,close,rt_sigprocmask,mprotect,_llseek -f /bin/bash -c "CLASSPATH=jna.jar:. java HelloWorld" 2>t5
Hello from C!
01:26:26$ grep libctest t5
[pid 3467] open("/usr/lib/jdk1.8.0_25/jre/bin/../lib/i386/jli/libctest.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 3467] open("/usr/lib/jdk1.8.0_25/jre/bin/../lib/i386/libctest.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 3467] open("/lib/tls/i686/sse2/libctest.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 3467] open("/lib/tls/i686/libctest.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 3467] open("/lib/tls/sse2/libctest.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 3467] open("/lib/tls/libctest.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 3467] open("/lib/i686/sse2/libctest.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 3467] open("/lib/i686/libctest.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 3467] open("/lib/sse2/libctest.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 3467] open("/lib/libctest.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 3467] open("/usr/lib/tls/i686/sse2/libctest.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 3467] open("/usr/lib/tls/i686/libctest.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 3467] open("/usr/lib/tls/sse2/libctest.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 3467] open("/usr/lib/tls/libctest.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 3467] open("/usr/lib/i686/sse2/libctest.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 3467] open("/usr/lib/i686/libctest.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 3467] open("/usr/lib/sse2/libctest.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 3467] open("/usr/lib/libctest.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 3467] stat64("/usr/lib/libctest.so", 0xb6756c4c) = -1 ENOENT (No such file or directory)
[pid 3467] stat64("/lib/libctest.so", 0xb6756c4c) = -1 ENOENT (No such file or directory)
[pid 3467] open("/usr/lib/jdk1.8.0_25/jre/bin/../lib/i386/jli/libctest.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 3467] open("/usr/lib/jdk1.8.0_25/jre/bin/../lib/i386/libctest.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 3467] open("/lib/libctest.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 3467] open("/usr/lib/tls/libctest.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 3467] open("/usr/lib/libctest.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 3467] stat64("/home/dunc/tests/ee130/linux-x86/libctest.so", 0xb675652c) = -1 ENOENT (No such file or directory)
[pid 3467] stat64("/home/dunc/tests/ee130/libctest.so", {st_mode=S_IFREG|0755, st_size=5548, ...}) = 0
[pid 3467] stat64("/home/dunc/tests/ee130/libctest.so", {st_mode=S_IFREG|0755, st_size=5548, ...}) = 0
[pid 3467] open("/home/dunc/tests/ee130/libctest.so", O_RDONLY|O_CLOEXEC) = 12
is what i mentioned. Did you try both?-Djna.debug_load.jna=true -Djna.debug_load=true
No, I missed that. Thank you, it does give the required information
12:52:00$ CLASSPATH=jna.jar:. java -Djna.debug_load.jna=true -Djna.debug_load=true HelloWorld
Trying (via loadLibrary) jnidispatch
Looking in classpath from sun.misc.Launcher$AppClassLoader@139a55 for /com/sun/jna/linux-x86/libjnidispatch.so
Found library resource at jar:file:/tmp/jna-4.1.0/dist/jna.jar!/com/sun/jna/linux-x86/libjnidispatch.so
Trying /tmp/jna-3095046/jna2870883308526223124.tmp
Found jnidispatch at /tmp/jna-3095046/jna2870883308526223124.tmp
Looking for library 'ctest'
Adding paths from jna.library.path: null
Trying libctest.so
Adding system paths: [/usr/lib, /lib]
Trying libctest.so
Looking for version variants
Looking in classpath from sun.misc.Launcher$AppClassLoader@139a55 for ctest
Found library resource at file:/home/dunc/tests/ee130/libctest.so
Looking in /home/dunc/tests/ee130/libctest.so
Found library 'ctest' at /home/dunc/tests/ee130/libctest.so
Hello from C!
Funny - i thought binaries had to be in the file system ;)Found library resource at jar:file:/tmp/jna-4.1.0/dist/jna.jar!/com/sun/jna/linux-x86/libjnidispatch.so
I don't understand your comment. /tmp/jna-4.1.0/dist/jna.ja r is in the file system
/tmp/jna-4.1.0/dist/jna.jaYes, but the library is inside the jar, and therefore isn'tr is in the file system
That's why you can put either directories or jar files in CLASSPATH. As I understand it, at least
It's probably a relatively new thing. I'm pretty certain that at one time, shared libraries HAD to be in the filesystem
Could be ... Firefox complained my Java plugin was vulnerable so I installed JDK8u25
Yes, that's important. Particularly now since Web Start supports the loading of native libraries (see above ;))
I tried with JDK7u45 - same
ASKER
Your link gives information what the source for this problem could be, but not a precise answer.
It think it might be a bitness issue. Try putting the library in SysWow64
http://www.samlogic.net/articles/32-64-bit-windows-folder-x86-syswow64.htm
http://www.samlogic.net/articles/32-64-bit-windows-folder-x86-syswow64.htm
Sorry - I can see I'm not being much help in this one. ;)
@sae1962at - please rerun your test as you did in http:#40440106 but also including -Djna.debug_load.jna=true -Djna.debug_load=true as in http:#a40445151. In other words
This should at least tell us what folders get searched.
You can paste the above line into a CMD window after you set the Quick Edit Mode Option (right-click title bar and select Properties then Options). After that, right-click pastes the clipboard contents to window; swipe to highlight a line then Enter puts the line on the clipboard.
This will save you having to try to re-type the line.
java -Djna.library.path=D:\projects\C -Djna.debug_load.jna=true -Djna.debug_load=true -classpath jna-4.1.0.jar;jna-platform-4.1.0.jar;. HelloWorld
This should at least tell us what folders get searched.
You can paste the above line into a CMD window after you set the Quick Edit Mode Option (right-click title bar and select Properties then Options). After that, right-click pastes the clipboard contents to window; swipe to highlight a line then Enter puts the line on the clipboard.
This will save you having to try to re-type the line.
ASKER
Hello, Duncan Roe! Here you go… :-)
Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. Alle Rechte vorbehalten.
C:\Windows\system32>CD /D %PROJECTS%
D:\projects>CD Java
D:\projects\Java>DIR
Datenträger in Laufwerk D: ist Volume
Volumeseriennummer: 0E8C-8BBC
Verzeichnis von D:\projects\Java
2014-11-13 14:03 <DIR> .
2014-11-13 14:03 <DIR> ..
2014-10-22 15:55 21.582 add.dll
2014-11-12 09:18 21.804 ctest.dll
2014-11-12 09:23 216 HelloWorld$CTest.class
2014-11-12 09:23 495 HelloWorld.class
2014-10-22 12:20 354 HelloWorld.java
2014-11-13 13:58 914.597 jna-4.1.0.jar
2014-11-12 15:06 1.464.423 jna-platform-4.1.0.jar
2014-10-22 15:42 21.804 libctest.dll
2014-10-22 15:59 434 Test$Add.class
2014-10-22 15:59 508 Test.class
2014-10-22 16:01 332 Test.java
11 Datei(en), 2.446.549 Bytes
2 Verzeichnis(se), 490.274.463.744 Bytes frei
D:\projects\Java>java -Djna.library.path=D:\projects\C -Djna.debug_load.jna=true
-Djna.debug_load=true -classpath jna-4.1.0.jar;jna-platform-4.1.0.jar;. HelloWo
rld
Trying (via loadLibrary) jnidispatch
Looking in classpath from sun.misc.Launcher$AppClassLoader@15db9742 for /com/sun
/jna/win32-x86-64/jnidispatch.dll
Found library resource at jar:file:/D:/projects/Java/jna-4.1.0.jar!/com/sun/jna/
win32-x86-64/jnidispatch.dll
Trying C:\Users\saban\AppData\Local\Temp\jna-109191937\jna7120142846334052427.dl
l
Found jnidispatch at C:\Users\saban\AppData\Local\Temp\jna-109191937\jna71201428
46334052427.dll
Looking for library 'ctest'
Adding paths from jna.library.path: D:\projects\C
Trying D:\projects\C\ctest.dll
Adding system paths: []
Trying D:\projects\C\ctest.dll
Looking for lib- prefix
Trying libctest.dll
Looking in classpath from sun.misc.Launcher$AppClassLoader@15db9742 for ctest
Found library resource at file:/D:/projects/Java/ctest.dll
Looking in D:\projects\Java\ctest.dll
Exception in thread "main" java.lang.UnsatisfiedLinkError: %1 ist keine zulässig
e Win32-Anwendung.
at com.sun.jna.Native.open(Native Method)
at com.sun.jna.Native.open(Native.java:1759)
at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:260)
at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:398)
at com.sun.jna.Library$Handler.<init>(Library.java:147)
at com.sun.jna.Native.loadLibrary(Native.java:412)
at com.sun.jna.Native.loadLibrary(Native.java:391)
at HelloWorld.main(HelloWorld.java:11)
D:\projects\Java>
"Keine zulaessige ..."
Not a permitted Windows32 application. In case another expert is short of a German dictionary.
Not a permitted Windows32 application. In case another expert is short of a German dictionary.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Please also post the output of
java -version
ASKER
Trying to close this question...