Skip to Main Content

Java HotSpot Virtual Machine

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Native method names

843829Jan 21 2004 — edited Jan 26 2004
I am new to JNi but have been through the tutorial and read many many threads in the forum.

I want to create a native method in my class (ShellExec.class) to initiate the ShellExecute function provided by microsoft in shell32.dll. I have created a native method called shellExecute which generates the method name "Java_ShellExec_shellExecute" in the header file (.h file). However, the native function is called "ShellExecute", so when I run my class I get an UnsatisfiedLinkError as the names don't match. javah always appends Java_classname_ to the method name.

Do I need to write a C or VB program with a function name of "Java_ShellExec_shellExecute" that in turn calls the ShellExecute function or is there some way of getting my method name to match the function name?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 23 2004
Added on Jan 21 2004
3 comments
169 views