RT

解决方案 »

  1.   

    getProperty("user.dir");不知这个属性名写错没有。?
      

  2.   

    public void testPath()
        {
    File f = new File("");

    String path = f.getAbsolutePath();

    System.out.println(path);
        }Output:E:\information\personal\workspace\poc\synchrophy\framework
      

  3.   

    没错
    System.getProperty("user.dir");
    可以得到程序的绝对路径
      

  4.   

    如果程序要打成 jar包的话,就不要用这个了,呵呵
      

  5.   


    System.out.println(System.getProperty("user.dir") +"\\"+ new TestApplet().getClass().getName());
      

  6.   

    getAbsolutePath(); //这个可以
    getProperty("user.dir");//这个没用过 正好学习了
      

  7.   

    System.getProperty("user.dir"); 
     
    学习下这个  马上实验下  
      

  8.   

    JAVA得到当前程序的绝对路径的2种方法
      

  9.   

    File f = new File(".");  //当前pathf.getPath();
      

  10.   

    System.getProperty("user.dir"); 
    只能得到Project的路径,不能得到文件路径
      

  11.   


    String name = Test.class.getCanonicalName().replace(".", "\\");
    System.out.println(System.getProperty("user.dir") + "\\" + name);
      

  12.   

    System.out.println(System.out.getProperty("uesr.dir"));是得到文件所在的包的路径;
    System.out.println(this.getClass().getResource().getPath());得到的是文件所在的路径;