zoukankan      html  css  js  c++  java
  • java获取类文件所在目录

    public static String getClassPath()
         {
                 String strClassName = testPath.class.getName();
                 String strClassFileName = strClassName.substring(strClassName
                                 .lastIndexOf(".") + 1, strClassName.length());
                 URL url = null;
                 url = testPath.class.getResource(strClassFileName + ".class");
                 String strURL = url.toString();
                 strURL = strURL.substring(strURL.indexOf('/') + 1);
                 boolean isWin = false;
                 int index = strURL.indexOf(":");
                 if (index > 0)
                         isWin = true;
                 if (!isWin)
                         return "/" + strURL;
                 return strURL;
         }
  • 相关阅读:
    git clone代码总是失败
    sublime常用快捷键及插件
    canvas圆形倒计时
    box-show的用法
    全选、反选
    数据库,增删改查
    PHP操作MySQL
    输出六个随机字符串
    约瑟夫环的故事
    Unix编程艺术——摘录一
  • 原文地址:https://www.cnblogs.com/macula7/p/1960413.html
Copyright © 2011-2022 走看看