NoClassDefFoundError 與 ClassNotFoundException 區別
Posted on 2011-09-08 08:59 itspy 閱讀(337) 評論(0) 編輯 收藏ClassNotFoundException
當你通過字符串加載一個Class時,如果出錯了就會拋出這個異常.比如.
The The The
ClassNotFoundException
如果程序在運行過程中,比如構造函數new一個對象時,觸發加載操作了而沒有找到對象.就會拋出這個異常.
詳情可以參考:
http://stackoverflow.com/questions/1457863/what-is-the-difference-between-noclassdeffounderror-and-classnotfoundexception
當你通過字符串加載一個Class時,如果出錯了就會拋出這個異常.比如.
forName
method in class Class
.findSystemClass
method in class ClassLoader
.loadClass
method in class ClassLoader
ClassNotFoundException
如果程序在運行過程中,比如構造函數new一個對象時,觸發加載操作了而沒有找到對象.就會拋出這個異常.
詳情可以參考:
http://stackoverflow.com/questions/1457863/what-is-the-difference-between-noclassdeffounderror-and-classnotfoundexception