如何从属性文件初始化ORB?

如何从属性文件初始化ORB?,第1张

如何从属性文件初始化ORB?

您还必须添加

-ORBInitRef
到ORB参数。将其与您通常使用的命令行进行比较。所有参数都必须传递给
ORB.init()

config.properties:

ORBInitRef NameService=corbaloc::localhost:2809/NameService

使用它的Java代码(ReadProps.java)

import java.io.FileInputStream;import java.io.IOException;import java.util.Properties;import org.omg.CORBA.ORB;public class ReadProps {    public static void main(String[] args) {        ORB clientsORB = org.omg.CORBA.ORB.init(readConfigFile(), null);    }    static String[] readConfigFile() {        Properties prop = new Properties();        String[] orbarg = new String[2];        try { // load a properties file prop.load(new FileInputStream("config.properties")); // get the property value and print it out   orbarg[0] = "-ORBInitRef"; // <---- NEEDED orbarg[1] = prop.getProperty("ORBInitRef");        } catch (IOException ex) { ex.printStackTrace();        }        return orbarg;    }}


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5562199.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-14
下一篇 2022-12-14

发表评论

登录后才能评论

评论列表(0条)

保存