The GenJava Development Tool

In order for Java clients to access .NET objects in a .NET assembly using J-Integra® for .NET, Java proxies must be generated from the assembly. These Java proxies in turn are deployed on the Java platform to be referenced by the clients. The GenJava development tool is a pure Java tool that invokes GenService to obtain details about the assembly, and generate Java proxies from it. This section describes how to generate Java proxy files on an assembly using GenJava.

When reading this section, keep in mind the following important details:

Starting GenJava

Use this section as a quick reference to start GenJava.

Starting GenJava in Windows:

Launch GenJava from the Start Menu.

Note: When starting GenJava from Windows, it will automatically search for genjava.xml in $USER_INSTALL_DIR$
Starting GenJava in Command-Line:
java -jar $USER_INSTALL_DIR$\lib\genjava.jar [arguments]
Note: When starting GenJava from command-line, it will automatically search for genjava.xml from where the java command was issued.

Possible arguments include:

Argument Description Example
-f | -file filename
Read settings from filename
-f genjava.xml
-n | -nogui
Launch GenJava in non-interactive mode (see below).
-n

The J-Integra® for .NET runtime (janet.jar) must also be in $USER_INSTALL_DIR$\lib. The main class that is called when launching GenJava is com.intrinsyc.janet.genjava.GenJavaApp.

How to Use GenJava

GenJava can be started in interactive, or non-interactive mode.

Interactive Mode

  1. When GenJava first starts, it uses IP multicast to find existing instances of GenService:

    Note: Your screen may look diffent based on installed .NET platforms.  If possible, please choose Genservice_20 as it can analyze all framework versions .NET assemblies.  For details of the two GenService versions, please refer to the section Multiple Versions: Genservice & GenService 2005 in the GenService section.

    Select an instance and click Next>.

    If, for whatever reason, multicasting is unavailable on your network, then GenJava will fail to find any instances of GenService that aren't running locally:

    If you select Enter Host Manually and click Next>, you will be prompted to manually enter a URI where GenService can be found. You should enter the following URI and click OK:

    		tcp://[GenService machine]:8001
    		
    	

  2. The next screen prompts for the location of the assembly along with the output directory where the Java proxies will go. The Browse... button for the location of the assembly will be disabled if GenService was found to be remote rather than local to the machine that GenJava was started from.

  3. The final screen shows the output of the generation, and if there were any errors encountered:

    Notice the warning message displayed in the screenshot:

    		**Server ignored: non-public or not MarshalByRefObject/Serializable
    		
    	

    GenService will display this message for every .NET class that it encounters that does not inherit from MarshalByRefObject (mandatory for marshal by reference objects as dictated by .NET Remoting) or have the Serializable attribute (mandatory for marshal by value objects). Such classes will be ignored and no Java proxy generated for them.

Non-Interactive Mode

GenJava is normally used interactively, with a graphical user interface, but it can also be run without stepping through the GUI wizard. This can be useful when GenJava is used as part of an automated build procedure, for example. To use GenJava in this non-interactive mode, GenJava must first be run in interactive mode to create a valid settings file. It can then be run again non-interactively using the same settings.

To create the settings file, simply run through the steps above and once generation has been successful and the Finish is clicked, a settings file will be created and saved to genjava.xml. If GenJava is run from Windows, then genjava.xml will be created in $USER_INSTALL_DIR$, otherwise, it will be created from wherever GenJava was launched on the command-line.

To run in non-interactive mode, GenJava must be started from the command-line. Review Starting GenJava to see how to start GenJava in non-interactive mode.

If the settings file is read and processed correctly, GenJava creates the proxies immediately and exits. All status and error messages are displayed on the console's standard output and standard error streams.

© 2007 Intrinsyc Software International, Inc. All rights reserved. Legal