6 messages in net.java.dev.jna.usersRe: [jna-users] How to use jna.jar
FromSent OnAttachments
Jeff SadowskiAug 1, 2007 11:59 am 
Timothy WallAug 1, 2007 12:50 pm 
Jeff SadowskiAug 1, 2007 1:39 pm 
Timothy WallAug 1, 2007 3:18 pm 
Jeff SadowskiAug 1, 2007 3:28 pm 
Jeff SadowskiAug 1, 2007 4:03 pm 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: [jna-users] How to use jna.jarActions...
From:Jeff Sadowski (jeff@gmail.com)
Date:Aug 1, 2007 4:03:58 pm
List:net.java.dev.jna.users

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".