我今天写了个ftp上传,不过配置文件的路径总是不对,希望高手帮助调下错~!配置文件在同级目录下,private static String configFile = "()";括号类的路径该怎么写?包:package com.guibin.pub;

解决方案 »

  1.   

    你可以先ftp 上传的是不是linux呢.
    linux 的路径你先在root下看能否访问这个文件。如果能在回到程序里面。
      

  2.   

    《Java资源的定位方式》,参考一下吧。
      

  3.   

    //当前类的classpath的URI目录  
    System.out.println(FilePath.class.getResource("/"));  
    //当前类的classpath的URI目录  
    System.out.println(FilePath.class.getClassLoader().getResource(""));  
    可以参考
    http://blog.csdn.net/swandragon/archive/2009/11/05/4770445.aspx
      

  4.   

    private final static String EXPORT_CONFIG_PATH = "/export/config.properties";
    Configuration.class.getClassLoader().getResourceAsStream(EXPORT_CONFIG_PATH);
      

  5.   

    private final static Stringchinese wholesalers
    ugg_CONFIG_PATH = "/export/config.properties";
    Configuration.class.getClassLoader().getResourceAsStream(EXPORT_CONFIG_PATH);