On Sun, Oct 17, 2010 at 3:14 PM, G T Smith
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Arani Bhattacharya wrote:
Hi,
I am trying to build a simple program using Java Native Interface, but trying to execute the Java program gives me an error. I am giving the program and the procedure that I have used here.
Code:
public class MyClass {
public static native void hello();
public static void main (String args[]) { MyClass m=new MyClass(); m.hello();
} static { System.loadLibrary("MyClass"); } }
Then, I have compiled this program file using the command javac MyClass.java.
Hmm...
For JNI check the some of the relevant Java Docs
http://download.oracle.com/javase/1.4.2/docs/guide/awt/1.3/AWT_Native_Interf... http://download.oracle.com/javase/1.5.0/docs/guide/jni/spec/jniTOC.html http://java.sun.com/docs/books/jni/download/jni.pdf
the above are a start..In particular look at the getting started section in the last link.....
- -- ============================================================================== I have always wished that my computer would be as easy to use as my telephone. My wish has come true. I no longer know how to use my telephone.
Bjarne Stroustrup ============================================================================== -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org/
iEYEARECAAYFAky6xV8ACgkQasN0sSnLmgIVFACg3VNecH8h1XbsEvfrNbsbLfdP tg4AoI9NwGnZQQ9Y0AJ8RYBSCTZOt/PS =1l4i -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse-programming+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-programming+help@opensuse.org
Thanks a lot for your ideas. I checked the references and discovered that merely adding the current directory to the classpath does not force Java to check for shared libraries (required for native access). Instead I had to add -Djava.library.path=$PWD for this task. Thanks once again. -- To unsubscribe, e-mail: opensuse-programming+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-programming+help@opensuse.org