How to use a DLL created using VB in Java?



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

.



Relevant Pages

  • Re: Java programmer lured back by .Net (Questions)
    ... in .NET a form is simply a class so yes it could easily be placed into a DLL and then use Ngen to make a native image of it. ... Of course it learned a lot from Java, and improved upon many things which Java is slowly catching up on. ... As far as code security you're in the same boat as Java since it compiles down to MSIL instead of bytecode of which both can reverse engineered very easily. ... I would like to be able to place my executable on my remote server and then "load" the executables on demand from accross the internet - so that there are no executables on the local machine for prying eyes to reverse engineer. ...
    (microsoft.public.dotnet.distributed_apps)
  • Re: Java programmer lured back by .Net (Questions)
    ... in .NET a form is simply a class so yes it could easily be placed into a DLL and then use Ngen to make a native image of it. ... Of course it learned a lot from Java, and improved upon many things which Java is slowly catching up on. ... As far as code security you're in the same boat as Java since it compiles down to MSIL instead of bytecode of which both can reverse engineered very easily. ... My backend is pure Java running on Unix - but because SWING is so ...
    (microsoft.public.dotnet.distributed_apps)
  • Re: JNI EXCEPTION_ACCESS_VIOLATION
    ... I am not experienced in coding a dll and access it via ... Java, but, I would say to you that, if you do not mind, try to use the ... The code will crash when running under XP Service Pack 2 ... The code will NOT crash when running under Windows 2000 Service Pack 4 ...
    (comp.lang.java.programmer)
  • Re: JNI interoperating with .net DLL?
    ... CLR DLL which export extern "C" function API to call 3. ... It works by calling as a standalone java class. ... what I need is to call functions in this class from a TOMCAT environment. ... I realised that if I remov the "Actual .NET" function call in the CLR DLL in step 2. ...
    (comp.lang.java.programmer)
  • Re: JNI Loading a Library 2 times
    ... I am having good success converting this Model to a dll and then loading the dll in Java using "System.loadLibrary". ... Allows me to keep the 2 memory locations separate, And allows me to call functions on both instances of the libraries. ... TankModel tank_A = new TankModel; ...
    (comp.lang.java.programmer)