zoukankan      html  css  js  c++  java
  • 从类里获取tomcat classes绝对路径

    从类里获取tomcat classes绝对路径

    从类里获取tomcat classes绝对路径

    1 从类里获取tomcat classes绝对路径

    有两种方法得到:

    1:  class.getResource("/").getPath(); 需要jaxen-*.jar
    2:  class.getClassLoader().getResource("").getPath();
    

    注意:

    1:  ClassLoader.getSystemResource("").getPath();
    

    好像是可以得到classes的绝对路径,但是得不到tomcat classes绝对路径, 这是由于jvm问题(等待再分析)。 普通工程可以使用,但web工程不能使用。

    Date: 2012-11-21 21:09:27 CST

    Author: machine of awareness

    Org version 7.8.06 with Emacs version 23

    Validate XHTML 1.0
  • 相关阅读:
    Python学习--10 面向对象编程
    Python学习--09 模块
    Python学习--08函数式编程
    JSON的简单例子
    error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.
    Failed to create the Java Virtual Machine.问题的解决
    导入项目时Loading descriptor ...
    Tomcat Server Timeouts属性的设置
    Type mismatch: cannot convert from java.sql.PreparedStatement to com.mysql.jdbc.PreparedStatement
    MySQL的Incorrect string value错误
  • 原文地址:https://www.cnblogs.com/machine/p/2781501.html
Copyright © 2011-2022 走看看