Adding native method in custom jdk package
Bob Vandette
bob.vandette at oracle.com
Wed Mar 22 17:22:44 UTC 2017
Checkout this blog that provides a simple example of how to create and call a native
function in a shared library.
https://blogs.oracle.com/moonocean/entry/a_simple_example_of_jni <https://blogs.oracle.com/moonocean/entry/a_simple_example_of_jni>
Let me know if you have any questions,
Bob.
> On Mar 22, 2017, at 12:32 PM, Christian Hagedorn <ch-hagedorn at hispeed.ch> wrote:
>
> Hi,
>
>
>
> I have created a class Test.java in an own package test.lang inside the jdk
> ("jdk/src/share/classes/test/lang/Test.java"). Now I wanted to add a native
> method.
>
> I found out that my header was created inside"
> build/linux./jdk/gensrc_headers/test_lang_Test.h".
>
> So I have tried to just create a new file inside a new folder
> "jdk/src/share/native/test/lang/Test.c" including "test_lang_Test.h".
>
> From there I do my JNICALL to the VM like it is done for example in
> "jdk/src/share/native/java/lang/System.c".
>
> However this still results in a UnsatisfiedLinkError. I am sure I have to do
> some more steps to link and add it to the build properly. What am I missing?
>
>
>
> Best regards,
>
> Christian
>
>
>
More information about the hotspot-dev
mailing list