Ok I downloaded jna.jar and am trying to use it, but with no success.
How do I find out where to place the jna.jar file?
I just created a simple C library as follows
cat << END > hello.c
char * hello()
{
return "hello world\n";
}
END
gcc -shared -o hello.so hello.c
now I want to use it in java
cat << END > hellow.java
import com.sun.jna.*;
import java.util.*;
class hellow
{
public interface helloworld extends Library {
char[] hello();
}
public static void main(String[] args)
{
System.out.print(helloworld.hello());
}
}
END
javac hellow.java
hellow.java:1: package com.sun.jna does not exist
import com.sun.jna.*;
^
hellow.java:5: cannot find symbol
symbol : class Library
location: class hellow
public interface helloworld extends Library {
^
hellow.java:10: non-static method hello() cannot be referenced from a
static context
System.out.print(helloworld.hello());
^
3 errors
I have jna.jar in the same directory where I created hellow.java