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

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-08-06
  • 2021-05-21
  • 2022-01-14
  • 2022-02-13
  • 2021-06-11
  • 2023-01-16
猜你喜欢
  • 2021-09-14
  • 2022-12-23
  • 2021-10-13
  • 2022-01-03
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案