thanks so much I feel so much less frusterated
Here is what I have so far
cat << END > hello.c
int hello()
{
return 5;
}
END
gcc -shared -o libhello.so hello.c
PWD=`pwd`
export CLASSPATH=.:jna.jar
cat << END > hellow.java
import com.sun.jna.*;
import java.util.*;
class hellow
{
public interface helloworld extends Library {
int hello();
}
public static void main(String[] args)
{
String oldjnalibpath = System.setProperty("jna.library.path","$PWD");
helloworld lib = (helloworld)Native.loadLibrary("hello",helloworld.class);
System.out.println(lib.hello());
}
}
END
javac hellow.java
java hellow
and that works :-)
but isn't there a way to pass classpath in the file also?
I found the way to set jna.library.path :-)
On 8/1/07, Timothy Wall <twal...@dev.java.net> wrote:
On Aug 1, 2007, at 4:39 PM, Jeff Sadowski wrote:
Ok I can start with an even simpler example I still get all the errors
trying to compile.
I know my main problem at this time is trying to load the jna class.
I don't understand using anything other than standard function
calls in java.
I've never used a class located in a jar file before.(I think the
standard function calls are in jar files somewhere but thats besides
the point)
You should consider doing a few basic Java tutorials.
javac -classpath .:jna.jar <sources>
java -cp .:jna.jar -Djna.library.path=<path-to-libhello.so> <main-
class-name>
And you need to name your library "libhello.so", not "hello.so".