D
drgonzo120
Hello,
it's been 2 years since my last java-programming, and now i want
restart my connection to the java-universe ... but hell.. has been that
long ago ? i'm having trouble, not so much with the syntax and
architecture, but rather with the typical compiling errors,
classpath-shit & company, jre ? jdk ? , i'm using the eclipse
thingie...
so now i want to test the java JNI example that is online on the
SUN-website
this is how my java directory in program files looks like:
java/j2re1.4.2
java/j2re1.4.2_06
java/jre1.5.0_02
java/jre1.5.0_04
no where i can find javah.exe (how do you use that with eclipse anyway)
only thing i can find is java.exe & javaw.exe , when i try the javah
(which i couldn't find no where except for the j2ee directory:
C:\Sun\AppServer\jdk\bin) but i guess my mind says so ,( i never did
java except on school and studentjob and one time at my house, but
don't remember) i need the java DEVELOPMENT kit and not the java
RUNTIME environment ? N00b ) nothing to worry about i mumbled to
myself and i cheated and copied the example code to the .h file .... so
i'm in step 3 "create the header file")
which looks like
*********
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class HelloWorld */
#ifndef _Included_HelloWorld
#define _Included_HelloWorld
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: HelloWorld
* Method: displayHelloWorld
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_HelloWorld_displayHelloWorld
(JNIEnv *, jobject);
#ifdef __cplusplus
}
#endif
#endif
********************
next trouble: how do i create a dll file without a c++ compiler ? i
have the source code though ...:
******
#include <jni.h>
#include "HelloWorld.h"
#include <stdio.h>
JNIEXPORT void JNICALL
Java_HelloWorld_displayHelloWorld(JNIEnv *env, jobject obj)
{
printf("Hello world!\n");
return;
}
******
(i'm not gonna write the c code myself ) i can write c++ though, what
is a good free compiler ? i don't have the dll file , i run w2k, is a
dll file different for let's say xp and 98 ?
this is what i can find on the creation of the dll file:
*****
On Microsoft Windows, the following command builds a dynamic link
library hello.dll using Microsoft Visual C++ 4.0:
cl -Ic:\java\include -Ic:\java\include\win32
-LD HelloWorldImp.c -Fehello.dll
*****
and of course you guess it... i don't have visual mickey goes c++...
dead end ...
anyway, i wanted to run this code that was surely headed for distaster
and got the error the guide predicted (woohoo for myself):
***
java.lang.UnsatisfiedLinkError: no hello in java.library.path
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at HelloWorld.<clinit>(HelloWorld.java:6)
Exception in thread "main"
***
***
If you see an exception like the following, then you don't have your
library path set up correctly.
java.lang.UnsatisfiedLinkError: no hello in shared library path
at java.lang.Runtime.loadLibrary(Runtime.java)
at java.lang.System.loadLibrary(System.java)
at
at java.lang.Thread.init(Thread.java)
***
but the error just wants to say i don't have the dll file, i guess ...
so anybody out there that wants to get me on track please ???
thank you so much !!!
it's been 2 years since my last java-programming, and now i want
restart my connection to the java-universe ... but hell.. has been that
long ago ? i'm having trouble, not so much with the syntax and
architecture, but rather with the typical compiling errors,
classpath-shit & company, jre ? jdk ? , i'm using the eclipse
thingie...
so now i want to test the java JNI example that is online on the
SUN-website
this is how my java directory in program files looks like:
java/j2re1.4.2
java/j2re1.4.2_06
java/jre1.5.0_02
java/jre1.5.0_04
no where i can find javah.exe (how do you use that with eclipse anyway)
only thing i can find is java.exe & javaw.exe , when i try the javah
(which i couldn't find no where except for the j2ee directory:
C:\Sun\AppServer\jdk\bin) but i guess my mind says so ,( i never did
java except on school and studentjob and one time at my house, but
don't remember) i need the java DEVELOPMENT kit and not the java
RUNTIME environment ? N00b ) nothing to worry about i mumbled to
myself and i cheated and copied the example code to the .h file .... so
i'm in step 3 "create the header file")
which looks like
*********
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class HelloWorld */
#ifndef _Included_HelloWorld
#define _Included_HelloWorld
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: HelloWorld
* Method: displayHelloWorld
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_HelloWorld_displayHelloWorld
(JNIEnv *, jobject);
#ifdef __cplusplus
}
#endif
#endif
********************
next trouble: how do i create a dll file without a c++ compiler ? i
have the source code though ...:
******
#include <jni.h>
#include "HelloWorld.h"
#include <stdio.h>
JNIEXPORT void JNICALL
Java_HelloWorld_displayHelloWorld(JNIEnv *env, jobject obj)
{
printf("Hello world!\n");
return;
}
******
(i'm not gonna write the c code myself ) i can write c++ though, what
is a good free compiler ? i don't have the dll file , i run w2k, is a
dll file different for let's say xp and 98 ?
this is what i can find on the creation of the dll file:
*****
On Microsoft Windows, the following command builds a dynamic link
library hello.dll using Microsoft Visual C++ 4.0:
cl -Ic:\java\include -Ic:\java\include\win32
-LD HelloWorldImp.c -Fehello.dll
*****
and of course you guess it... i don't have visual mickey goes c++...
dead end ...
anyway, i wanted to run this code that was surely headed for distaster
and got the error the guide predicted (woohoo for myself):
***
java.lang.UnsatisfiedLinkError: no hello in java.library.path
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at HelloWorld.<clinit>(HelloWorld.java:6)
Exception in thread "main"
***
***
If you see an exception like the following, then you don't have your
library path set up correctly.
java.lang.UnsatisfiedLinkError: no hello in shared library path
at java.lang.Runtime.loadLibrary(Runtime.java)
at java.lang.System.loadLibrary(System.java)
at
at java.lang.Thread.init(Thread.java)
***
but the error just wants to say i don't have the dll file, i guess ...
so anybody out there that wants to get me on track please ???
thank you so much !!!