String urlString = ClassLoader.getSystemClassLoader().getResource("com/my/package/MyClass.class").toString();
urlString = urlString.substring(urlString.indexOf("file:"), urlString.indexOf('!'));
URL url = new URL(urlString);
File file = new File(url.toURI());
System.out.println(file);
System.out.println(file.exists());
final String bootClassPath;
final String[] entries;
// different VM may use a different string here...
bootClassPath = System.getProperty("sun.boot.class.path");
entries = bootClassPath.split(File.pathSeparator);
for(final String entry : entries)
{
System.out.println(entry);
}
RuntimeMXBean.getBootClassPath
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)