![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| calling a unix script in one box from another box | trichyselva | Shell Programming and Scripting | 1 | 03-23-2007 02:09 PM |
| calling unix script from JSP??? | Bhups | Shell Programming and Scripting | 1 | 06-07-2006 11:32 AM |
| calling script in target machine | bryan | UNIX for Dummies Questions & Answers | 1 | 05-10-2006 03:41 PM |
| missing Path(in UNIX) when i launch a job on to unix machine using windows SSh | megastar | UNIX for Advanced & Expert Users | 1 | 11-04-2005 07:36 AM |
| calling UNIX script from C/C++ | omran | High Level Programming | 3 | 08-23-2002 07:21 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Unix Machine for calling Native Method of C
hi all
i have a unix machine (FBD). I have Also installed java of Version (j2sdk1.4.1_07) on unix machine. Now i want to Call C Native function in Java Which is declared as Native. i am doing this by following steps: 1) Making Echo.java File Which is having The following lines of code. class Echo { public native void runEcho(); static { System.loadLibrary("echo"); } public static void main(String[] args) { new Echo().runEcho(); } } 2) Compiling the Code: $ javac Echo,java $ javah Echo ----- which will make the header file used in c programe 3) writing the EchoImp.c File Which contains the following line of code #include "jni.h" #include "Echo.h"//the java class above compiled with javah #include <stdio.h> JNIEXPORT void JNICALL Java_Echo_runEcho(JNIEnv *env, jobject obj) { char buf[64]; gets(buf); printf(buf); } 4) Making the Library echo $ cc -G -I/usr/local/java/include -I/usr/local/java/include/linux Echo.c -o libecho.so 5) Now Setting The Libarary Path $ setenv LD_LIBRARY_PATH <Path> 6) Now Finally Excute the Java Program to call c function $ java Echo but while executing i m getting Error Like : Exception in thread "main" java.lang.UnsatisfiedLinkError: no echo in java.libra ry.path at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1403) at java.lang.Runtime.loadLibrary0(Runtime.java:788) at java.lang.System.loadLibrary(System.java:832) at Echo.<clinit>(Echo.java:5) i have also set the path but no results .... plz help me out Kamal Kant email removed sb Last edited by vino; 11-08-2006 at 03:33 AM.. |
| Bookmarks |
| Tags |
| linux |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|