Win a copy of Rust Web Development this week in the Other Languages forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

can RMI and VB talk?

Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
im developing a chat program RMI based. Since the GUI in java handled by layouts and doesn’t fit to my needs (as a graphic designer) I found that Visual Basic is more suitable and faster tool to take care of the GUI development.
There is a way to connect a Java server (RMI) and a Visual Basic client? If so I would like to receive source to learn how to establish this communication.
Shay Gaghe
High Plains Drifter
Posts: 7289
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, yes and no. VB does not natively connect with a remote VM (you can guess why), and has no built-in communication interface for talking 'natively' to that protocol.
One way to do this, however, as long as the client has a JVM locally available: you could encapsulate the RMI behavior as a JavaBean, which could then be bridged into an OLE/COM container, which could then be added to a VB application.
Or you can go fishing on the internet for such a solution, and see if someone's already done that, but my guess is such solutions have probably been custom written. You don't find too many people who want VB front ends but Java communication. I don't know much about it, but wouldn't SOAP be the easier thing to integrate?
Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can call the methods of a Java class on a remote server by packaging the java class as an ActiveX control.
The steps are as follows.
[assuming c:/java is defined as your class path and the package name you have used is com.shay.beans; , and your class name is TestBean.class]

1. Copy the class file to the folder c:\java\com\shay\beans
2. Using any text editor create a manifest file called and copy it to c:\jaba\meta-inf\manifest. The manifest file should contain the text
Name : com/shay/beans/Enigma.class
Java-Bean : True
There should be no spaces before of after the text. Watch out for trailing spaces after the last character.
3. Run the jar utility with the following parameters.
jar -cvfm MyBean.jar meta-inf/ com/shay/bean/TestBean.class

You get a jar file called MyBean.jar . Open it with winzip to verify the contents of the manifest file. If it does not read as it should you can delete the manifest file and insert one using winzip, but remember that the path should read as "\meta-inf\"
4. Start the packager utility with the command
java -classpath d:/jdk1.3/jre/lib/jaws.jar sun.beans.ole.Packager
This has a GUI and is rather easy to use. Just select MyBean.jar and it does the rest.
5. The packager generates a .reg file and .tlb (type library) file.
6. Double click the registry file to register the component.
7. Once you have the ActiveX control registered on the server you can access it from the client by using the CreateObject method.
Dim myVariant as Variant
Set myVariant = CreateObject("ObjectName", "ServerName")

You need not have a VM on the client. All this stuff has to be done on the server. Your client machine will just have the VB front end.
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you did want to run the JVM locally with the VB front-end ... There is a beta COM Bridge that I have played around with and it appears to work.
JavaTM 2 Platform, Enterprise Edition Client Access Services (J2EETM CAS) COM Bridge 1.0 Early Access
I don't know when that would be getting out of beta, but you would be able to run some of the business logic locally (helpful for performance reasons).
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic