You can't just load Shell32.dll and make a JNI call to it.  You have to create a
JNI DLL with wrapper functions.  The reason for this is that JNI sends two extra
parameters with every call and unless the DLL and the methods know about these
parameters, your calling conventions are incorrect.  There is a program
javah.ese in the SDK1.3/bin directory that will create a JNI header from a java
class.  Use that to create the function headers for your C wrapper.  Then make
sure you have the header files in the SDK1.3/include and SDK1.3/include/win32
accessible to your compiler.  Include jni.h which will include other header
files from the SDK include directories.  The functions should look something
like:

/*
 * Class:     FTIServiceManager
 * Method:    GetServiceStatus
 * Signature: ()Ljava/lang/String;
 */
JNIEXPORT jstring JNICALL Java_FTIServiceManager_GetServiceStatus
  (JNIEnv *, jobject);

This is from a DLL I had created to manage NT services through a servlet.

Hope this helps.






Purav <[EMAIL PROTECTED]> on 02/27/2001 01:02:45 AM

Please respond to "A mailing list for discussion about Sun Microsystem's Java
      Servlet API Technology." <[EMAIL PROTECTED]>

To:   [EMAIL PROTECTED]
cc:    (bcc: Scott E Herter/MSD/US/PBI)

Subject:  Native Method...Please Help



Hi,

I wantto shut down windows thru my application. so I copied the shell32.dll
in the directory my app files reside.
but i get the following  error

Exception in thread "main" java.lang.UnsatisfiedLinkError: no shell32.dll in
jav
a.library.path
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1133)
        at java.lang.Runtime.loadLibrary0(Runtime.java:470)
        at java.lang.System.loadLibrary(System.java:745)
        at Shut.<clinit>(Shut.java:6)


I have set the classpath..but it still gives the same error


Please Help


Purav
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.231 / Virus Database: 112 - Release Date: 2/12/01

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to