Skip to main content
using a real list
Source Link
Paŭlo Ebermann
  • 75k
  • 20
  • 150
  • 217

doDo the following:

1/ change your java class to

class Hello { public native void sayHello(); static { System.loadLibrary("hello"); } public static void main(String[] args) { Hello h = new Hello(); h.sayHello(); } } 

2/ rename hello.so to libhello.so: "cp hello.so libhello.so" or "mv hello.so libhello.so"

3/ run as: "java -Djava.library.path=/home/gavin/Work/workspace/JNI/ Hello"

  1. change your Java class to this:

     class Hello { public native void sayHello(); static { System.loadLibrary("hello"); } public static void main(String[] args) { Hello h = new Hello(); h.sayHello(); } } 
  2. rename hello.so to libhello.so: cp hello.so libhello.so or mv hello.so libhello.so

  3. run as: java -Djava.library.path=/home/gavin/Work/workspace/JNI/ Hello

do the following:

1/ change your java class to

class Hello { public native void sayHello(); static { System.loadLibrary("hello"); } public static void main(String[] args) { Hello h = new Hello(); h.sayHello(); } } 

2/ rename hello.so to libhello.so: "cp hello.so libhello.so" or "mv hello.so libhello.so"

3/ run as: "java -Djava.library.path=/home/gavin/Work/workspace/JNI/ Hello"

Do the following:

  1. change your Java class to this:

     class Hello { public native void sayHello(); static { System.loadLibrary("hello"); } public static void main(String[] args) { Hello h = new Hello(); h.sayHello(); } } 
  2. rename hello.so to libhello.so: cp hello.so libhello.so or mv hello.so libhello.so

  3. run as: java -Djava.library.path=/home/gavin/Work/workspace/JNI/ Hello

added 54 characters in body
Source Link
aioobe
  • 422.6k
  • 115
  • 831
  • 844

do the following:

1/ change your java class to

class Hello {

class Hello { public native void sayHello();  static {   System.loadLibrary("hello");  }  public static void main(String[] args) {   Hello h = new Hello();   h.sayHello();  } } 

}

 

2/ rename hello.so to libhello.so: "cp hello.so libhello.so" or "mv hello.so libhello.so"

3/ run as: "java -Djava.library.path=/home/gavin/Work/workspace/JNI/ Hello"

do the following:

1/ change your java class to

class Hello {

public native void sayHello(); static { System.loadLibrary("hello"); } public static void main(String[] args) { Hello h = new Hello(); h.sayHello(); } 

}

2/ rename hello.so to libhello.so: "cp hello.so libhello.so" or "mv hello.so libhello.so"

3/ run as: "java -Djava.library.path=/home/gavin/Work/workspace/JNI/ Hello"

do the following:

1/ change your java class to

class Hello { public native void sayHello();  static {   System.loadLibrary("hello");  }  public static void main(String[] args) {   Hello h = new Hello();   h.sayHello();  } } 
 

2/ rename hello.so to libhello.so: "cp hello.so libhello.so" or "mv hello.so libhello.so"

3/ run as: "java -Djava.library.path=/home/gavin/Work/workspace/JNI/ Hello"

Source Link
Nick
  • 71
  • 1
  • 1

do the following:

1/ change your java class to

class Hello {

public native void sayHello(); static { System.loadLibrary("hello"); } public static void main(String[] args) { Hello h = new Hello(); h.sayHello(); } 

}

2/ rename hello.so to libhello.so: "cp hello.so libhello.so" or "mv hello.so libhello.so"

3/ run as: "java -Djava.library.path=/home/gavin/Work/workspace/JNI/ Hello"