[919] in java-interest

home help back first fref pref prev next nref lref last post

Re: Native Method Woes

daemon@ATHENA.MIT.EDU (Thomas Ball)
Tue Aug 15 16:10:58 1995

Date: Tue, 15 Aug 1995 09:31:25 -0700
From: Thomas.Ball@Eng.Sun.COM (Thomas Ball)
To: issi-tn@ix.netcom.com
Cc: java-interest@java.Eng.Sun.COM

The main() method is a static (class) method, while you've defined an
non-static (instance) native method.  (I'm assuming that LoadMain() and
LaunchMain() are the same, and you made a typo.)  Either create an 
instance of your Test class to invoke the native method, or make the
native method static.  I don't know of any code that implements static
native methods, so you may be exploring uncharted territory there. :-)

Tom

>  From daemon@java  Tue Aug 15 08:13:55 1995
>  Subject: Native Method Woes
>  To: java-interest@java.sun.com.I.am.in.the.process.of.testing.out.native.methods,
>          but.I.can't@ix.netcom.com
>  X-Info: To unsubscribe, send 'unsubscribe' to java-interest-request@java.sun.com
>  
>  initial tester program to run.  All that my java main method does is 
>  call a native C method; the C dll links in fine when I run the 
>  interpreter, but I get a message that I can't use a static reference to 
>  my native method.  Here's my code:
>  
>          class Test {
>            static {
>              Linker.loadLibrary("javademo");
>            }
>  
>            public static void main (String args[]) {
>              LoadMain();
>            }
>  
>            public native void LaunchMain();
>          }
>  
>  
>                      Thanks,
>                      Stephen Owens
>  
>  -
>  Note to Sun employees: this is an EXTERNAL mailing list!
>  Info: send 'help' to java-interest-request@java.sun.com
>  
-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post