aspose file tools*
The moose likes Java in General and the fly likes JNI Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "JNI" Watch "JNI" New topic
Author

JNI

Leandro Oliveira
Ranch Hand

Joined: Nov 07, 2002
Posts: 298
here is the source code for class Java.lang.Object.
I would like to know what does 'registerNatives()'
do in the source code???
I would like to study very hard java, do you think it's a good choice to study all classes including the low level JNI interface???

package java.lang;
public class Object {
private static native void registerNatives();
static {
registerNatives();
}
public final native Class getClass();
public native int hashCode();
public boolean equals(Object obj) {
return (this == obj);
}
protected native Object clone() throws CloneNotSupportedException;
public String toString() {
return getClass().getName() + "@" + Integer.toHexString(hashCode());
}
public final native void notify();
public final native void notifyAll();
public final native void wait(long timeout) throws InterruptedException;
public final void wait(long timeout, int nanos) throws InterruptedException {
if (timeout < 0) {
throw new IllegalArgumentException("timeout value is negative");
}
if (nanos < 0 || nanos > 999999) {
throw new IllegalArgumentException(
"nanosecond timeout value out of range");
}
if (nanos >= 500000 || (nanos != 0 && timeout == 0)) {
timeout++;
}
wait(timeout);
}
public final void wait() throws InterruptedException {
wait(0);
}
protected void finalize() throws Throwable { }
}
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
Studying JNI is a good idea. Studying the low level JNI interfaces is pretty much un-necessary unless you intend to do something fairly low level yourself.
For most application programmers their time would be better spent understanding other things.


"JavaRanch, where the deer and the Certified play" - David O'Meara
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
Oh, the registerNatives method finds all the native methods required by the JVM. You know, the ones that do things like hooking up the operating system files to in/out/err streams, and talking to the hardware etc.
Leandro Oliveira
Ranch Hand

Joined: Nov 07, 2002
Posts: 298
is it the same as
System.loadLibrary("library_name");
but it loads all the libraries??? is this???
thanks a lot!!!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JNI