Spacer Spacer Spacer Spacer Spacer Spacer Spacer Spacer Spacer Spacer Spacer Spacer
R1c1 home products company support R1c10 Spacer
R2c5 Spacer
vbj_home features download doc price buy Prod_nav_faq_roll Prod_r3c8 Spacer
Prod_r4c1 Prod_vbj   Spacer
Spacer

FAQ

  1. Why translate VB.Net to Java?
  2. What about VB6?
  3. What version of VB.Net does VBeeJ translate?
  4. How do I install and run VBeeJ?
  5. Does VBeeJ require a particular Java development environment?
  6. What does VBeeJ produce?
  7. 'Info' messages are output. What are these? How should I respond?
  8. 'Warning' messages are output. What are these? How should I respond?
  9. 'Error' messages are output. What are these? How should I respond?
  10. I have a VB.Net class I want to translate but I don't want to translate all the classes and interfaces it depends on. Can I do this? What should I expect?
  11. A 'beelucid' directory is created. What is this directory for? What does it contain?
  12. I see the types 'StringBridge', 'ObjectBridge', and the like in the output. What are these?
  13. I see a 'SystemBridge' class in the output. What is this for?
  14. VB.Net has built in support for events and event handling. How does VBeeJ translate this?
  15. VB.Net has a built in Decimal type and Java doesn't. How does VBeeJ handle that?
  16. VB.Net supports attributes which are platform (Windows.Net) specific. How does VBeeJ handle these?
  17. VBeeJ produces parse errors but I think my VB.Net program is correct. What does this mean?

The Beelucid philosophy is that you should be able to leverage your software investment across platforms according to your business requirements. Our mission is support you in this task.

Java is the target language of VBeeJ because it has many compelling attributes. Here is a quick summary:

  • Advanced object-oriented language
  • Large libraries
  • Common set of APIs
  • Rigorously tested platform
  • Lots of skilled programmers available
  • Automatic memory management

Also, Java is platform independent. Your code will run on any operating system. New versions of Java are for the most part strongly source compatible with previous versions. Java is free. Java standard class libraries are free, large, diverse, and secure. Free, robust, and advanced development envionments are available for Java.

(For an example, see the Eclipse Platform. All examples in Beelucid documentation use the Eclipse Platform (3.2.0). VBeeJ can be as an external tool within the Eclipse SDK. Click the link to see the Run->Run... menu showing that setup.)

Java has a huge standard class library. The functions supported by this class library range from simple String support to networking and graphic user interface creation. Java is a reasonably large programming language, but its complexity is easily superseded by the class library. Sun licenses the source for the class library, so any vendor that agrees to Sun's terms can support the class library on their Java platform. As a result, the Java class library is both large and ubiquitous, creating a standard software environment on all Java platforms. The great popularity that Java has enjoyed has resulted in a huge body of literature on all aspects of the Java class library. This reduces the learning curve and makes the class library easier to use.
Back to top

VB6 and VB.Net are quite different languages in syntax, features, and underlying object model. VB6 must first be translated to VB.Net before VBeeJ will be able to handle it. There are a number of tools available that handle the translation from VB6 to VB.Net. After the VB6 has been translated to VB.Net, VBeeJ can translate it to Java.
Back to top

VBeeJ accepts all of VB.Net 2003 (VB 7.1) and many of the features in VB.Net 2005 (VB 8.0), including inheritance of generic types, the Using keyword, and more. Unsupported features in VB 8.0 may get parse errors for unrecognized syntax and the translation will not occur. Implementation of VB.Net 2005 is ongoing. Please contact Beelucid Support if you have particular requirements.


Back to top

Installing VBeeJ

  1. Installing on Windows

    Select the Windows option for the download of VBeeJ. This will result in the download of a Windows installer which will install VBeeJava.exe into a directory of your choice.

  2. Installing on other platforms

    Select the tar.zip option for the download of VBeeJ. You will unzip and extract VBeeJava.jar into a location of your choice. The syntax is gzip -d VBeeJava.tar.gz followed by tar xvf VBeeJava.tar.

Running VBeeJ

VBeeJ can be run with the gui, or from the command line, or as an external tool within the Eclipse Platform. All the examples show VBeeJ used as an external tool within the Eclipse Java IDE, Version 3.2. Note that VBeeJ requires a jre of version 1.6.0 or higher to run.

  1. Running the VBeeJ gui on Windows

    Click on the VBeeJ icon and the gui will execute. You can select files to translate, target directory, and hints files in the gui.

  2. Running the VBeeJ gui on other platforms

    If no options and no input files are present on the command line, executing the jar brings up the gui:

    java -jar /path/to/VBeeJava.jar

  3. Options for running VBeeJ on the command line

    On Windows the command line form is:

    VBeeJava.exe [options] input files

    On other (Unix-based) platforms the command line form is:

    java -jar VBeeJava.jar [options] input files

    The options are

    -d directory_name The target directory for the generated Java files, optional.

    -hints file_name.vb A hints file, optional. Can specify multiple times (discussed here).

  4. Running VBeeJ within the Eclipse Platform

    The Eclipse Platform supports a powerful Java IDE. Running VBeeJ within this environment allows you to utilize the Eclipse Java IDE for your translated files. Click the link to see the External Tools menu within Eclipse.

    Note that in the linked image above, Run_VBeeJava appears at the top of the External Tools Run Menu. It has already been defined. Click this link to see how to define the command Run_VBeeJava on the Windows platform. (This command uses the Windows file separator in paths and the Windows executeable. Click this link for a Unix example.) The Location text field specifies the location of VBeeJ executeable for your installation. Note that the Working Directory specifies the path to the Eclipse workspace, followed by the project directory, followed by the topmost package directory. All these components of the Working Directory are required. Note that the input file is located in the topmost package directory, and it is specified by name as an argument in the Arguments text box. If more input files or any options (-d or -hints) are used, they should be entered into the Arguments text box. (For an example that specifies -d in the Arguments text box, click this link .)

    The results of executing the Eclipse command Run_VBeeJava are shown here . The topmost_package_dir, which originally contained the source to be translated, now also contains the translated file. Note that translated file specifies the topmost_package_dir as its package. Visual Basic namepaces are translated into Java packages. If the input source has namespaces, their packages will be relative to the topmost package directory.

Back to top

No. VBeeJ produces Java source files which can be used with any Java development environment. If you are unfamiliar with Java development environments, the Eclipse Platform is a good (free) choice. VBeeJ can be conveniently run as an external tool under the Run menu within this environment.
Back to top

Here is a simple example, where the input and output is shown in the Eclipse Platform (version 3.2).

  1. VB.Net Input

    Click the link to view a simple test program which defines a property. The source file contains a base class and a derived class. Note Option Strict On. This is not required but it is recommended.

    VBeeJ accepts all of VB.Net 2003 (VB 7.1) and many of the features in VB.Net 2005 (VB 8.0), including inheritance of generic types, the Using keyword, and more. Unsupported features in VB 8.0 may get parse errors for unrecognized syntax and the translation will not occur. Implementation of VB.Net 2005 is ongoing. Please contact Beelucid Support if you have particular requirements.

  2. Java Output

    Click the link to view the result of translation. Three files are created, for each class in the input source. Each defines a Java class with the same name as the class in the input source. Note that the Module is translated to a final class.

    The translated code includes the comments from the original source.

    The Java produced by VBeeJ conforms to Java version 1.6.0.

  3. The beelucid Directory

    VBeeJ also creates a beelucid directory which contains Bridge classes as well as stubs for classes and methods whose definition is not available in the VB.Net source. Bridge classes provide a 'bridge' between similar classes on the different platforms. Click the link to show the contents of the beelucid directory for this test case. A few Bridge classes are shown, including the Bridge classes which support Events and EventHandlers. Bridge classes may also be generated for primitive types. The SystemBridge class supports platform and library functionality. The contents of the beelucid directory will vary depending on the characteristics and requirements of the source program. All class definitions are in the form of Java source files.

Back to top

'Info' messages are messages which describe the translation choices made by VBeeJ. They are for infomational purposes, to help you understand the generated code better. In general no response is required.

In the message, the source file name is followed by a line number and message category, and followed by the message text.

[TestRedim.vb] 1: Beelucid info: Every Visual Basic namespace creates a package directory in the Java context (namespace 'TestRedim')

Click the link to view an example of VB.Net source with its translation and translation messages. The linked example shows info messages, warning messages, and an error message.

Back to top

'Warning' messages are messages which notify the user that the Java translation may not completely match the VB.Net functionality for all cases. You should check the code indicated by these warning messages. The more common cases will most likely require no modification.

In the message, the source file name is followed by a line number and message category, and followed by the message text.

[TestRedim.vb] 6: Beelucid warning: Visual Basic operator 'GetType(<className>)' translated to Java '<classname>.class', which has equivalent but not identical functionality and syntax.

Click the link to view an example of VB.Net source with its translation and translation messages. The linked example shows info messages, warning messages, and an error message.

Back to top

'Error' messages are messages which notify the user there is no Java construct or functionality that can be automatically translated to implement the VB.Net statement. There aren't many of these and they are mostly generated for features included in VB.Net for VB6 compatibility. You will need to check the code and manually translate.

In the message, the source file name is followed by a line number and message category, and followed by the message text.

[TestRedim.vb] 8: Beelucid error: 'ReDim' statement requires manual translation if the operand has not been declared with specific dimensions but is an object of 'Array' type (array name 'my3DIntArray').

Click the link to view an example of VB.Net source with its translation and translation messages. The linked example shows info messages, warning messages, and an error message.

Back to top

VBeeJ is designed to be flexible, powerful, and robust even when information about class definitions and interfaces used by the source program is missing or incomplete. It contains a powerful type inference engine. This allows it to handle missing classes and interfaces in source programs and also allows VBeeJ to gracefully and consistently handle changes in the .Net platform itself or in the VB libraries.

Click the link to view an example that shows a VB.Net source program which contains references to a class whose definition is not available. The translated code is also shown.

Note the last message is an 'info' message that indicates that VBeeJ found references to a class whose definition is not available. The user is directed to the beelucid directory where a stub class for this type has been created, with methods inserted as appropriate. Method signatures were inferred by the type inference engine. Click the link to view the stub class in the beelucid directory.

Back to top

VBeeJ creates a beelucid directory which contains Java support for .Net functionality as well as stubs for classes whose definition is not available in the VB.Net source. Click the link to show the contents of the beelucid directory for a test case. This example shows only the minimum default contents of the beelucid directory. This example does not contain any references to classes whose definitions are not available. Note that the Bridge classes which support Events and EventHandlers are listed, as well as a few Bridge classes. The latter provide a 'bridge' between similar classes on the different platforms. The SystemBridge class supports platform and library functionality.

Click the link to show the contents of the beelucid directory for a test case which does contain references to a class whose definition is not available (the class called UnknownClass). Note method stubs for the class have been generated. The signatures of the method stubs have been inferred by the type inference engine.

The contents of the beelucid directory will vary depending on the characteristics and requirements of the source program. All class definitions are in the form of Java source files.

Back to top

VB.Net supports primitive types Boolean, Char, Byte, Short, Integer, Long, Single, and Double. Java's parallel types are boolean, char, byte, etc. Basic types in Java and VB.Net behave identically in some contexts but not in others. Where they behave identically, the translation is direct. Where they do not behave identically, a Bridge type wrapper object is created, that wraps the underlying basic value. The Bridge type definitions are contained in the beelucid directory.

For example, a VB.Net statement of the form

Dim II As Integer = 3

translates directly into the Java variable initialization statement

int II = 3;

VB.Net primitive types and Java basic types are parallel but they do not behave identically in all contexts. The VB.Net variables are objects which support services. An int variable in Java is a simple value. When this difference results in a difference of functionality or behavior, VBeeJ uses bridge types to bridge the difference. The goal is to have your VB.Net program translate into legal Java.

For example, in VB.Net, the following variable initialization relies on the fact that Integer variables are object of class Integer:

Dim II As New Integer(3) 'Integer is a class and 'New' creates a new Integer object

A direct translation of this into a Java initialization would not be legal because int is a value not an object type:

int II = new int(3); // Illegal Java because 'new' can't be used to create a value

In this example, VBeeJ will generate a IntegerBridge class in the beelucid directory in order to create the int value:

int II = new IntegerBridge(3).intValue();

The IntegerBridge class creates an object which is a wrapper for the underlying Java basic int value, and the method intValue() returns that underlying value.

Back to top

The SystemBridge contains stubs as well as some implementations for library and system functions, some generated by default and others generated because they were identified in code. Click this link to view the default SystemBridge class.

Back to top

VBeeJ implements complete and robust support of support of events and event handling. For events, the class EventBridge is generated. This class associates an event object with a set of handlers, which can be added and removed. For event handling, the class EventHandlerBridge is generated, which supports associating a handler with an event object.

VBeeJ will generate all the code needed to fully implement in Java the event and event handling functionality in your VB.Net program. Click this link to view a VB.Net example Test.vb which has a WithEvents variable, an event class, an event handler, and raises an event.

Click this link to view classes in Test.vb after they've been translated into Java. The translated classes use the bridge classes. The VB.Net Event variable MyEvent has the type in Java of EventBridge, which associates MyEvent with a set of handlers. The class declaring this event, MyEventClass, utilizes the class EventHandlerBridge, to support associating handlers with MyEvent. For a high level view of EventBridge and EventHandlerBridge click this link .

After running the source through VBeeJ, this example compiles and executes identically on both platforms with no modification.

Back to top

VBeeJ translates Decimal in VB.Net to BigDecimal in Java. This means that operations performed with operators in VB.Net are performed with BigDecimal methods in Java. Click this link to view an example.

Back to top

At this time attributes are ignored. If you have suggestions as to particular attributes which you think should be supported, please send an email with your thoughts and rationale to Beelucid Enhancements. Thanks in advance for your input.

Back to top

VBeeJ supports VB.Net 2003 and many of the features of VB.Net 2005. This means other versions of VB may not parse, although implementation of VB.Net 2005 is ongoing and upgrades with its features will be regularly available. If you think you have a bug, please file a bug report.

Back to top

Spacer
R7c1 Spacer