Java 从xml中的.properties调用路径

Java 从xml中的.properties调用路径,java,xml,Java,Xml,我有一个调用路径的xml,位置是硬编码的 <path=c:/... /> 有人知道如何使用.properties将其放入路径中,然后从那里调用它吗? 我这样做是出于安全考虑 编辑 遵循教程 入站的路径调用如下: <file:inbound-endpoint path="C: ../> 加载属性文件的代码是: Properties prop = new Properties(); prop.load(new FileInputStream("C:

我有一个调用路径的xml,位置是硬编码的

<path=c:/... />

有人知道如何使用.properties将其放入路径中,然后从那里调用它吗? 我这样做是出于安全考虑

编辑

遵循教程

入站的路径调用如下:

<file:inbound-endpoint  path="C: ../>

加载属性文件的代码是:

    Properties prop = new Properties();
    prop.load(new FileInputStream("C:\\prop.properties"));
    String path = prop.getProperty("pathname");
但是您有指向属性文件的硬代码路径: 您可以将路径作为主方法的参数传递:

public static void main(String Args[]){ 
    try {
        if(Args != null){
            if(Args[1] != null){//Load XML or prop File                 try{
                    properties.load(new FileInputStream(Args[1]));
                }catch(Exception e){
                    throw new Exception("Error loading PropertieFile: "+Args[1] + " :"+e.getMessage());
                }
            }else{
                throw new Exception("No File Found!");
            }

请添加一些示例代码,以便我们更好地理解您的意思。
    Properties prop = new Properties();
    prop.load(new FileInputStream("C:\\prop.properties"));
    String path = prop.getProperty("pathname");
public static void main(String Args[]){ 
    try {
        if(Args != null){
            if(Args[1] != null){//Load XML or prop File                 try{
                    properties.load(new FileInputStream(Args[1]));
                }catch(Exception e){
                    throw new Exception("Error loading PropertieFile: "+Args[1] + " :"+e.getMessage());
                }
            }else{
                throw new Exception("No File Found!");
            }