• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to invoke VB DLL from java  RSS feed

 
bhargav reddy
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a requirement where i have to invoke VisualBasic DLL from java.

Any information in this direction would be helpful.

Thanks,
Bhargav
 
Stephan van Hulst
Saloon Keeper
Posts: 7928
143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You will have to use Java Native Interface. Look around for JNI.
 
Rob Spoor
Sheriff
Posts: 21117
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out JNI. It's unusual to use a Visual Basic DLL (C or C++ are more common) but I don't think it's impossible.
 
bhargav reddy
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Thanks for the replays.

JNI --- its only for C++ DLLs, i tried loading VB DLLs using system.load and trying to invoke the method.
But i get exceptions.

--Bhargav
 
Paul Clapham
Sheriff
Posts: 22701
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, you would have to write a wrapper for the DLL. That's quite often the case even if the DLL you have was written in C++; a DLL suitable for JNI has to be written in a certain way, to map the data types correctly.

You could look into JNA. I have no experience with it, but its home page looks pretty good to me.
 
Rob Spoor
Sheriff
Posts: 21117
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
bhargav reddy wrote:JNI --- its only for C++ DLLs, i tried loading VB DLLs using system.load and trying to invoke the method.

No it isn't. I've used Delphi to write JNI code. But as Paul said, you can't load any non-JNI DLL directly.
 
bhargav reddy
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Paul and Rob, let me try with JNA and update the thread.

Bhargav
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!