• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

native methods

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why calling a native method like this result in a runtime error?

Maybe we have to load a library?
Then why in the StrictMath class there's code like this?

the class's comment states that all the algorithm gives the same
result as certain published algorithms.



/**These
* algorithms are available from the well-known network library
* <code>netlib</code> as the package "Freely Distributable
* Math Library" (<code>fdlibm</code>
* The network library may be found on the World Wide Web at:
* <blockquote><pre>
* <a href="http://metalab.unc.edu/">http://metalab.unc.edu/</a>;
* </pre></blockquote>
* <p>
**/


When this Library is loaded if no code there declares something
like this?
[ February 17, 2003: Message edited by: Igor Zeta ]
 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is it a runtime error or a compile time error?
Does your code compile?
The first line needs a semicolon.
 
Igor Zeta
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
provided the semicolon this is
the resulting run-time error:


java.lang.UnsatisfiedLinkError: amethod
at provecocoon.NewSuper.amethod(Native Method)
at provecocoon.NewSuper.main(NewSuper.java:25)
Exception in thread "main"

 
Dan Culache
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry, I didn't read carefully. I thought you were trying to use a native method defined in the StrictMath class. I'm not familiar with the Java linkage process but I'm sure this is what you need to do, specify a library. I believe your method "amethod" should be part of a library which was built using the Java Native Interface.
see Java Native Interface
 
reply
    Bookmark Topic Watch Topic
  • New Topic