CORBA---Jacorb的安装与编译
Jacorb安装配置
?
1、到http://www.jacorb.org/download.html下载合适的版本并解压到本地,
2、设置环境变量
? ? ? 添加F:\jacorb-3.0\bin到path,并创建JACORB_HOME变量为F:\jacorb-3.0
3、修改idl.bat
? ? ?F:\jacorb-3.0\bin目录下会自带一个idl.bat.tpl的文件,该文件只是一个示例,需要重命名为idl.bat
? ? 并修改文件内容。
? ? 当然要确保有java环境和JAVA_HOME变量 ?
@echo off"%JAVA_HOME%\bin\java" -classpath "%JACORB_HOME%\lib\idl.jar;%CLASSPATH%" org.jacorb.idl.parser %*
?
4、在命令行中执行idl -h,显示帮助信息,说明已配置完成。
C:\Documents and Settings\Administrator>idl -h -h|help these few lines of help -v|version print version information -d dir root of directory tree for output -Dx define preprocessor symbol x with value 1 -Dx=y define preprocessor symbol x with value y -Idir set include path for idl files -U<symbol> undefine preprocessor symbol -W [1..4] debug level -all generate code for all IDL files, even included ones -forceOverwrite generate code even if IDL has not changed -ami_callback generate AMI reply handlers and sendc methods -ami_polling generate AMI poller and sendp methods -backend classname use classname as code generator -addbackend classname add classname as code generator -i2jpackage x:a.b.c replace IDL package name x by a.b.c in generated Java code (e.g. CORBA:org.omg.CORBA) -i2jpackagefile <filename> replace IDL package names using list from <filename>. Format as above. -ir generate information required by the Interface Repository -nofinal generated Java code will contain no final class definitions -unchecked_narrow use unchecked_narrow in generated code for IOR parameters in operations -noskel disables generation of POA skeletons -nostub disables generation of client stubs -diistub generate dii-based client stubs -cldc10 code generation compatible with J2ME/CLDC 1.0 -sloppy_forward allow forward declarations wo. later definitions -sloppy_names less strict checking of module name scoping -sloppy_identifiers Allow certain illegal identifiers. -permissive_rmic tolerate dubious IDL generated by JDK's rmic, includes -sloppy_names. -genEnhanced Generate toString and equals on stubs. Only supported on Struct currently. -generate_helper (portable[default]|jacorb|deprecated). Controls the controls the compatibilty level of the generated helper code. -cacheplugin classname set plu gin for cache code generation -syntax syntax check only, no code generation <filelist>
?
编译IDL文件
?
执行以下命令:
?
C:\Documents and Settings\Administrator>idl -all -d F:\project\corbaTest -in F:\project\corbaTest\*.*
?其中-d后的目录为生成代码的目录,-in后的目录为idl文件的所在目录
?
?
执行以下命令可以修改包名
?
C:\Documents and Settings\Administrator>idl -all -d F:\project\corbaTest -i2jpackagefile f:\format.txt -in F:\project\corbaTest\*.*
?
?
format.txt的内容
?
MyServer:com.cheng.MyServer
?
?至此,使用jacorb将idl编译成java代码已完成
?
?
?
?
?