Capitalization and NoClassDefFoundError vs ClassNotFoundException

只愿长相守 提交于 2019-12-05 09:31:05

HFS+ (Mac Extended) is usually not case sensitive. Since Mac OS 10.3 Apple introduced HFSX which can be case sensitive (but is not the default). If you did not specify the option by the disk initialization then your volume is most likely case insensitive.

See: http://en.wikipedia.org/wiki/HFS_Plus

There's no bug here. What you're seeing is caused entirely by the case-sensitivity of the filesystem.

When loading the class dLExceptionType on a case-insensitive filesystem, the JVM can find a file dLException.class. However, the class it contains doesn't have the name dLException, and this causes the NoClassDefFoundError. When attempting to load this class on a case-sensitive filesystem, the JVM can't find the file at all.

A NoClassDefFoundError with (wrong name: ...) in the message is thrown by the JVM whenever it loads a class that appears to have a different name to the filename it was read from. You can try this on any filesystem by renaming the class file and attempting to run it.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!