获取类所在jar的路径
ClassLoader classloader = XmlOptions.class.getClassLoader();
URL res = classloader.getResource("org/apache/xmlbeans/XmlOptions.class");
String path = res.getPath();
以上代码是获取 XmlOptions类的路径
ClassLoader classloader = XmlOptions.class.getClassLoader();
URL res = classloader.getResource("org/apache/xmlbeans/XmlOptions.class");
String path = res.getPath();
以上代码是获取 XmlOptions类的路径