开发者

How to use java classes from visual basic 6?

开发者 https://www.devze.com 2023-03-01 16:59 出处:网络
I\'m doing a small project in college and my project guide only knows visual basic 6. He is insisting on using only VB6. I\'m very good in java and want to use java for the core functionality and VB6

I'm doing a small project in college and my project guide only knows visual basic 6. He is insisting on using only VB6. I'm very good in java and want to use java for the core functionality and VB6 only for the UI.

J-Integra may does this but it is not free, while JCom (sourceforge) seems to be for accessing COM objects like VB6 from Java and not the other w开发者_开发知识库ay around. Also somewhere I red that using javareg.exe, one can register java classes as COM and access as below, but I couldn't find javareg.exe anywhere.

Java class:

public class MyTest
{ 
  public int myfunction(int value1, int value2)
  {
    return value1 + value2;
  } 
}

VB

Private Sub Command1_Click()
  Set x = CreateObject("MyTest")
  MsgBox x.myfunction(500, 500)
End Sub

Anyone know how I can do as above?


While I think what I am about to suggest is a bad idea, it does work (or at least has worked for me 10 yrs ago). In my case I had to speak from a VB6 (or maybe it was VB5) to some business logic running on a Linux box. I added a TCP port listener to the app on the Linux end and spoke to it from VB6 via TCP packets. I basically used TCP as a bridge.

It actually worked pretty well. So you might do the something similar. But again, not a great idea.


While I'm far from VB6's (or VB in general) biggest fan, I would suggest that you bite the bullet and implement the whole project in VB6. Why? Because technology changes in Software over time and if you are only ever going to be fluent in one technology and haven't gone out of you comfort zone and written code in a language and a technology you're not familiar with, you will struggle to have a viable career in software development that lasts longer than a few years.


Well, you might compromise on Jabaco.

0

精彩评论

暂无评论...
验证码 换一张
取 消