0

我在 Eclipse 中添加了 orb 插件并创建了一个 IDL 文件。我将 IDL 编译器配置到具有 IDL 文件的项目中。当我右键单击 IDL 文件时,有一个选项如下, CORBA->Compile CORBA Stubs但是当我选择该选项没有发生任何事情,所以如何在 Eclipse 中编译 IDL 文件并生成 Java 文件。请提供是否有任何步骤/程序可以遵循来编译 IDL 文件并生成 Java 源文件

谢谢

4

3 回答 3

3

打开命令行并转到您拥有 IDL 文件的目录并运行此行

idlj -fall nameOfIdlFile.idl

例如,如果您的 idl 文件被命名HelloWorld.idl

idlj -fall HelloWorld.idl

运行上述命令行后,在您的根文件夹中,它将生成 java 类,即:

  • HelloWorld.java
  • HelloWorldPOA.java
  • HelloWorldStub.java
  • HelloWorldHelper.java
  • HelloWorldOperations.java
  • HelloWorldHolder.java。

希望这会对您或将来遇到相同问题的任何人有所帮助。

于 2012-11-22T08:19:42.657 回答
0

I am also having trouble with CORBA IDL compilation under Eclipse. The CORBA IDL compiler generates an error in the Eclipse error log = “Unhandled event loop exception” due to a “java.lang.NoClassDefFoundError: org/openorb/compiler/IdlCompiler” exception.

The above answer may work for "HelloWorld", but CORBA IDL files are a super-set of standard IDL syntax and have their own unique keywords like "typeprefix" and "local".

Therefore they must be compiled using the IDL compiler org.openorb.compiler.IdlCompiler.

One way to do this is using the ANT compiler. A sample ANT XML script would read:

 <target name="idl" depends="compiler" 
description="Generate java classes from idl." 
unless="nobuild.idl" >
<java classname="org.openorb.compiler.IdlCompiler" fork="yes">
  <arg line="-silence -all -I ${idl} -d ${gensrc}/main ${idl}/orb.idl ${idl}/interop.idl ${idl}/misc.idl ${idl}/openorb.idl"/>
  <classpath refid="project.class.path" />
  <sysproperty key="openorb.home" file="src" />
</java>
于 2013-10-31T14:00:45.543 回答
0

我知道线程现在有一些时间。但也许我无论如何都可以帮助别人。

对我来说,这个问题与配置有关。我所要做的就是选择项目,进入 Project->Properties,然后选择 IDL 编译。

在“编译选项”选项卡上选择我需要的选项,然后在“编译器”选项卡上,明确选择“OpenORB”。

然后它起作用了!:)

于 2016-12-04T11:44:27.673 回答