• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1499
  • Last Modified:

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 :)

Thanks,


Michael
0
Michael_D
Asked:
Michael_D
  • 4
  • 4
1 Solution
 
The_BiochemistCommented:
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!
0
 
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?
0
 
The_BiochemistCommented:
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.

1)  http://www.javaworld.com/javaworld/jw-01-2003/jw-0103-migration.html

2)  http://msdn.microsoft.com/vstudio/downloads/tools/jlca/default.aspx

Good Luck
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
The_BiochemistCommented:
P.S.

This talks about creating a J++ wrapper as oposed to converting an entire project.

http://support.microsoft.com/default.aspx?scid=kb;en-us;818429
0
 
softenggCommented:
Easiest way is to use one of the bridge available in Market commerically.
Microsoft recomemnds three options.
1. http://www.jnbridge.com/
2. http://j-integra.intrinsyc.com/


For reference http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag/html/jdni_ch04.asp
0
 
Michael_DAuthor Commented:
The_Biochemist:

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:
<Quote>
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
</Quote>

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
0
 
The_BiochemistCommented:
Right had another trawl of the net...

http://www.reallyusefulcomputing.com/tutorials.php?t=3&p=1 has a tutorial on the subject which in step 4 - http://www.reallyusefulcomputing.com/tutorials.php?t=3&p=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. http://forum.java.sun.com/thread.jspa?forumID=40&messageID=2639298&threadID=532297
0
 
Michael_DAuthor Commented:
The_Biochemist:

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?
0
 
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
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now