处理报错:java/lang/NoClassDefFoundError: java/lang/Object
处理报错:java/lang/NoClassDefFoundError: java/lang/Object 操作系统环境:CentOS6.0 2.6.32-220.el6.x86_64
JDK版本环境:jdk1.5.0_22 操作系统原来安装的是jdk1.6,后来开发人员要求java程序使用jdk1.5版本的。帮开发下载JDK1.5,
安装完JDK ,设定环境变量后出现这个错误:
- [root@fztest97 lib]# javac
- Error occurred during initialization of VM
- java/lang/NoClassDefFoundError: java/lang/Object
- [root@fztest97 lib]# java
- Error occurred during initialization of VM
- java/lang/NoClassDefFoundError: java/lang/Object
首先要确认的是环境变量的设置是否正确,其次,需要确认的就是lib和jre/lib文件夹中的rt和tools是否是打包后的形式,如果发现rt.pack 和 tools.pack 那么多半问题就出在这里。
解决方法也很简单,只要将相应文件解压成rt.jar 和 tools.jar,可以使用bin里面的unpack200工具,
如:unpack200 rt.pack rt.jar
/apps/usr/java/jdk1.5.0_22/lib/tools.pack 转为 tools.jar
/apps/usr/java/jdk1.5.0_22/jre/lib/rt.pack 转为 rt.jar 执行如下操作命令:
- [root@fztest97 ]# cd /apps/usr/java/jdk1.5.0_22/lib/
- [root@fztest97 lib]# unpack200 tools.pack tools.jar
- [root@fztest97 lib]# ls
- dt.jar ir.idl jconsole.jar orb.idl sa–jdi.jar tools.jar tools.pack
- [root@fztest97 lib]# cd /apps/usr/java/jdk1.5.0_22/jre/lib
- [root@fztest97 lib]# unpack200 rt.pack rt.jar
- [root@fztest97 lib]# ll rt.*
- –rw–r––r––. 1 root root 40232487 May 23 19:23 rt.jar
- –rw–r––r––. 1 root root 12960918 May 23 19:07 rt.pack
再次执行如下命令,进行验证:
- [root@fztest97 lib]# java –version
- java version “1.5.0_22”
- Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_22–b03)
- Java HotSpot(TM) 64–Bit Server VM (build 1.5.0_22–b03, mixed mode)
- [root@fztest97 lib]# javac
- Usage: javac <options> <source files>
- where possible options include:
- –g Generate all debugging info
- –g:none Generate no debugging info
- –g:{lines,vars,source} Generate only some debugging info
- –nowarn Generate no warnings
- –verbose Output messages about what the compiler is doing
- –deprecation Output source locations where deprecated APIs are used
- –classpath <path> Specify where to find user class files
- –cp <path> Specify where to find user class files
- –sourcepath <path> Specify where to find input source files
- –bootclasspath <path> Override location of bootstrap class files
- –extdirs <dirs> Override location of installed extensions
- –endorseddirs <dirs> Override location of endorsed standards path
- –d <directory> Specify where to place generated class files
- –encoding <encoding> Specify character encoding used by source files
- –source <release> Provide source compatibility with specified release
- –target <release> Generate class files for specific VM version
- –version Version information
- –help Print a synopsis of standard options
- –X Print a synopsis of nonstandard options
- –J<flag> Pass <flag> directly to the runtime system
到此为止,JDK1.5安装配置成功。
1. 本站所有资源来源于用户上传和网络,因此不包含技术服务请大家谅解!如有侵权请邮件联系客服!10210454@qq.com
2. 本站不保证所提供所有下载的资源的准确性、安全性和完整性,资源仅供下载学习之用!如有链接无法下载、失效或广告,请联系客服处理,有奖励!
3. 您必须在下载后的24个小时之内,从您的电脑中彻底删除上述内容资源!如用于商业或者非法用途,与本站无关,一切后果请用户自负!
4. 如果您也有好的资源或教程,您可以投稿发布,成功分享后有RB奖励和额外RMB收入!
磊宇堂正在使用的服务器 维护管理由磊宇云服务器提供支持
磊宇堂 » 处理报错:java/lang/NoClassDefFoundError: java/lang/Object
2. 本站不保证所提供所有下载的资源的准确性、安全性和完整性,资源仅供下载学习之用!如有链接无法下载、失效或广告,请联系客服处理,有奖励!
3. 您必须在下载后的24个小时之内,从您的电脑中彻底删除上述内容资源!如用于商业或者非法用途,与本站无关,一切后果请用户自负!
4. 如果您也有好的资源或教程,您可以投稿发布,成功分享后有RB奖励和额外RMB收入!
磊宇堂正在使用的服务器 维护管理由磊宇云服务器提供支持
磊宇堂 » 处理报错:java/lang/NoClassDefFoundError: java/lang/Object