Using Java Classes (.jar) from VB.NET/C#

Hi Experts.
I just wonder if it is possible to use Java Classes from VB.Net/C#.
I guess I need to create Wrapper class in J# , compile it into Dll and then refer to this Dll from VB/C# project.
Will this aproach work?
Any information about this issue will be very helpful becouse my knowledge of Java is close to nothing :)


LVL 13
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Sorry to say this but... You would probably have to re-write most of it in j# anyway to ensure the code is well managed and to make it bug free, that beggs the further question if you are used to VB/C# then is it more sensible to re-write it in one of those languages instead?

you may want to wait a while to see if others respond differently but I wouldn't hold your breath unfortunately!
Michael_DAuthor Commented:
The problem is I cannot change Java sources. I have to use it as is . (some API functions to interface with third-part application)
Any idea?
I'm gonna backtrack as found a site that talks about the migration of J++ and vj++ apps to J# or c#.Net (1) and they site a Microsoft developer center designed specifically for automatic migration of those apps (2). There are also shed loads of links on that topic within the MS dev center so have a look. If it is anything like the use of COM components within the .NET world it probably just creates a wrapper for you but i'm not sure.



Good Luck
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.


This talks about creating a J++ wrapper as oposed to converting an entire project.;en-us;818429
Easiest way is to use one of the bridge available in Market commerically.
Microsoft recomemnds three options.

For reference
Michael_DAuthor Commented:

Your 3rd link is very close to my needs. But as I mentioned before  I have no experience with java. Could you explain some issues in this article?
For example  it says:
1. Compile the Java-language or COM component by using the Visual J# .NET command-line compiler (Vjc.exe). For example, type the following at a command prompt, and then press ENTER to compile the code:
vjc /target:library JavaSources

I dont have the sources. Is result of this compilation .JAR file that I have?  

This article about migration of VJ++ to J#. Is it Ok that my java class was created on Borland enviroment?

Thank you
Right had another trawl of the net... has a tutorial on the subject which in step 4 - -  converts a JAR to an Active X control and then the active X control can be used in your .net code... hopefully?!?

There is also another comment in a discussion group which references the tutorial above... not sure of it's relevance but may make sense in context.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Michael_DAuthor Commented:

Sorry for delay, prioreties has been changed :)

I tryed ActiveX Bridge as you recomend in your last post. but unfortunatelly after I select the .jar file and have to choose JavaBean to convert into ActiveX Component. there is NO JavaBeans shown. Is it possible? I repeat I don't have sources so I can't change anything with .jar file

Any ideas?
Michael_DAuthor Commented:
Unfortunately I haven't solved my problem but I guess that my .Jar class doesn't  support this "bridge" thing.
Anyway, IMO this thread should be stored in EE database as solved solution
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.