Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / September 2005

Tip: Looking for answers? Try searching our database.

How to use a DLL  created using VB in Java?

Thread view: 
Srikanth - 30 Sep 2005 16:50 GMT
Hi,

I want to know how to uses a DLL in java.... For that I created a
simple ActiveX dll using VB 6... The following is the code that I have
inside that... I named the DLL Sample.dll....

--------------------------------------------
public function returnInteger() as Integer
   returnInteger = 10
end function
--------------------------------------------

I named the DLL as Sample.dll and I copied it to system32 folder of
windows...

This is only for to test... I want to know how to call this is a Java
program... I made some search and wrote this java code...

---------------------------------------------------------
public class CallNative {

    public native int returnInteger();
    static {
        System.loadLibrary("Sample");
    }

    public static void main(String[] args) {

        CallNative nativeObj = new CallNative();

        System.out.println(nativeObj.returnInteger());
    }
}
---------------------------------------------------------

The following is the error that I'm getting....
------------------------------------------------------------
java.lang.UnsatisfiedLinkError: add
    at com.srikanth.callnative.CallNative.returnInteger(Native Method)
    at com.srikanth.callnative.CallNative.main(CallNative.java:15)
Exception in thread "main"
------------------------------------------------------------

What should I do to access the returnInteger() function that I wrote
using VB??? I found that I should have a wrapper class and blah blah,
can anyone help me to call this simple method so that I can use my
other DLL that are written using VB (this is what I want to do in the
end).... Thank you very much for spending time to read this, please
help me if you know how to do it... Thank you once again

--Srikanth
Roedy Green - 30 Sep 2005 17:19 GMT
>I want to know how to uses a DLL in java.... For that I created a
>simple ActiveX dll using VB 6... The following is the code that I have
>inside that... I named the DLL Sample.dll....

the answer to that question takes a whole book. To get started see
http://mindprod.com/jgloss/jni.html
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.

Paul Cager - 30 Sep 2005 17:27 GMT
> >I want to know how to uses a DLL in java.... For that I created a
> >simple ActiveX dll using VB 6... The following is the code that I have
[quoted text clipped - 5 lines]
> Canadian Mind Products, Roedy Green.
> http://mindprod.com Again taking new Java programming contracts.

Be aware that using JNI requires some knowledge of C.
You could also access it using a Java / COM bridge, such as IBM's
Bridge2Java (also known as "Interface Tool").


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.