Having beat up wine, idltojava.exe and so forth to do 
idltojava compiling without leaving the linux box, I 
figured I'd share the information.  Feel free to include
this in a FAQ.  It Works For Me, Your Mileage May Vary.

---------------------------------------------------------------------

To perform idltojava processing on Linux you will need:


1) A recent distribution of wine from http://www.winehq.com. Wine is 
a windows binary loader for Linux.  It is capable of running a fair
amount of Windows executables on Linux.


2) Something equivalent to the following in your ~/.winerc file.
Substitute the path to your java development tools area for /opt/java
if necessary.  I keep all my java development tools under the
/opt/java directory, e.g. /opt/java/jdk1.2.2, /opt/java/jikes, etc.

[Drive J]
Path=/opt/java
Type=network
Label=java
Filesystem=win95

You should set up a similar network drive entry if your java source
files are kept in a different directory tree.


3) Sun's idltojava utility for Win32 platforms.  Download this from
http://developer.java.sun.com/developer/earlyAccess/jdk12/idltojava.html

Save the downloaded file as /opt/java/idltojava-ea-win32.exe
Extract the archive by: wine /opt/java/idltojava-ea-win32.exe

This will create a directory /opt/java/idltojava-win32, and store the
executable and documentation in that directory.


4) To compile idl files using idltojava.exe:

First, preprocess the idl using g++.  Gcc might work, but I haven't
tried it personally.  Include any predefined symbols and include paths 
(e.g. -DSYMBOL -I/some/idl/include/dir) as "other options", below.
The following line stores the output of the preprocessed file.idl as
Jfile.idl:

g++ -E [other options] - < file.idl > Jfile.idl

Second, invoke idltojava.exe via wine. Include the option "-fno-cpp"
to avoid invoking the preprocessor again.  You may want to include the
option "-fmap-included-files" to create java stubs/skeletons for
interfaces which are included via #include directives in the idl file:

wine /opt/java/idltojava-win32/idltojava.exe \
        -fno-cpp -fmap-included-files Jfile.idl

This creates a multitude of java source files.

Last, depending on which ORB you are attempting to operate with, you
may need to strip out the "IDL:omg.org" portion of the interface
specifications in the java sources.  This was required to interoperate 
with TAO (http://www.cs.wustl.edu/~schmidt/TAO.html).  Basically, if
you run into problems connecting to a server, try the following and
see if it works:

sed "s@IDL:omg.org/@IDL:@g" $file > $file.tmp ; mv $file.tmp $file

You will need to do this for each .java file generated by idltojava.


I use the following in my Makefile to perform processing via
idltojava.  The double quotes in the wine invokation are significant..  

---------------------------------------------------------------------

IDLCPP   = g++
IDLCPPOPTS = -E -DDEFINED_SYMBOL \
                -I/include/path/to/any/included/idl/files

WINE     = /opt/wine/bin/wine
IDLJAVA  = /opt/java/idltojava-win32/idltojava.exe
IDLJAVAOPTS = -fno-cpp -fmap-included-files

FIX_JAVA = /opt/java/fix_java.sh

FILEIDLJAVA = \
        first___java_file_output_from_idltojava.java \
        second__java_file_output_from_idltojava.java \
        ... \
        last____java_file_output_from_idltojava.java

$(FILEIDLJAVA): file.idl
        $(IDLCPP) $(IDLCPPOPTS) - < $< > J$<
        $(WINE) "$(IDLJAVA) $(IDLJAVAOPTS) J$<"
        $(FIX_JAVA) $(IPCIDLJAVA)

---------------------------------------------------------------------

The following is fix_java.sh as referenced in the Makefile rule above:

---------------------------------------------------------------------

#!/bin/sh

for file in "$@"; do
    echo Fixing: $file
    sed "s@IDL:omg.org/@IDL:@g" $file > $file.tmp
    mv $file.tmp $file
done

---------------------------------------------------------------------


-- ebm
+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=+
| Eric B. Mitchell         mailto:[EMAIL PROTECTED] |
| tel: (301) 809 - 3534    Altair Aerospace Corporation |
| tel: (800) 7 - ALTAIR    4201 Northview Dr. Suite 410 |
| fax: (301) 805 - 8122    Bowie, MD  20716             |
+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=+
              ,___
          /"\  / o=\  /"""---===/
         /   \_/  \__/   ---===/ 
         |    //\   || /""TT""/ //\   || ||""\
         |   //  \  ||    ||   //  \  || ||__/
         |  //--==\ |L--/ ||  //--==\ || || "=,
          \      ---===/
           \____---===/


----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to