---
title: "获取类是从那个jar包中加载的"
author: "bbsanwei"
date: "2016-09-08T00:05:37Z"
tags: []
categories: ["编程语言"]
slug: "jar"
draft: false
lastmod: "2016-09-08T00:49:10Z"
id: 2323235
url: "https://bbsanwei.iteye.com/blog/2323235"
---

http://www.ibm.com/developerworks/cn/websphere/library/techarticles/1108_jiangwk_classloader/1108_jiangwk_classloader.html


http://blog.itpub.net/145274/viewspace-591473/

http://www.ibm.com/developerworks/cn/websphere/library/techarticles/haoaili/0512/

http://3ms.huawei.com/hi/blog/41349_1800137.html


```java

     ClassLoader classLoader = TestClassLoad.class.getClassLoader();
        URL resource = classLoader.getResource("org/apache/http/message/BasicLineFormatter.class");
        System.out.println(resource);
        
        FileUpload fu = new FileUpload(); 
        java.security.CodeSource cs = fu.getClass().getProtectionDomain().getCodeSource(); 
        System.out.println("CodeSource of FileUpload is: " + cs.toString());


```