『java』java.lang.ClassFormatError: Test (unrecognized ...
来源:互联网 发布:网络弹窗广告 编辑:程序博客网 时间:2024/06/06 00:01
Exception in thread "main" java.lang.ClassFormatError: Test (unrecognized class file version)
运行时出现这个错误通常是运行环境JRE的版本与class文件编译的JDK版本不一致所致 。
我的编译环境是jdk1.7,试图执行如下命令以重新编译class文件为目标版本:
1
C:\>javac -target 1.6 Test.java
2
javac: 目标发行版 1.6 与默认的源发行版 1.7 冲突
3
4
C:\>javac -target 1.5 -
source
1.5 Test.java
5
警告: [options] 未与 -
source
1.5 一起设置引导类路径
发现上面的第一种方式不行,需要同时带-target和-source两个参数才能编译成1.5版。
参考:
用javac编译生成不同版本的源码和目标class
深入理解java类版本冲突的问题
用javap查看编译版本
使用javap分析你的程序性能(以字符串拼接为例)
问题重述:CentOS下自带1.4 jdk,没注意这个,直接在/usr下安装jdk-6u22-linux-i586.bin,添加环境变量后(可以在/root/.bash_profile中添加)写test会报这个异常,接着我删除了原有版本的java,同时清掉相关环境变量,就可以了。
安装1.6如:http://developer.51cto.com/art/200907/134477.htm
- 『java』java.lang.ClassFormatError: Test (unrecognized ...
- java.lang.ClassFormatError unrecognized class file version 解决办法
- java.lang.ClassFormatError unrecognized class file version 解决办法
- java.lang.ClassFormatError翻译
- java.lang.ClassFormatError
- ALERT: java/lang/ClassFormatError: Bad version information.
- ALERT: java/lang/ClassFormatError: Bad version information.
- javac encounter 'java.lang.ClassFormatError' error
- 【java】 java.lang.ClassFormatError: Invalid method Code length 错误
- 错误 java.lang.ClassFormatError: Invalid method Code length 的解决办法
- J2ME错误处理: ALERT: java/lang/ClassFormatError: Bad version information
- java.lang.ClassFormatError: JVMCFRE068 class name is invalid
- java.lang.ClassFormatError: Absent Code attribute in method
- 有关java.lang.ClassFormatError: Truncated class file错误
- 该死的 java.lang.ClassFormatError: Illegal method name "<init>$" 错误
- java.lang.ClassFormatError: Absent Code attribute...javax/xml/rpc/ServiceException
- java.lang.NoClassDefFoundError: Java/Test
- JBuilder2006开发j2me错误(java/lang/ClassFormatError: Bad version information)
- 第11周项目一--调用函数输出星号图(2)
- 给超链接加onclick事件
- 求二个数的最大公约数
- 单机配置MYSQL多实例
- 部署iwebshop,ecshop到Linux服务器
- 『java』java.lang.ClassFormatError: Test (unrecognized ...
- 安卓 ListView 几个重要属性
- Codility -- Number-of-disc-intersections
- SQL Server 横转纵 行转列
- 读取Android账号类型
- Apk/Jar包混淆方法
- 真机上查 /data/data的shared_prefs目录
- php四种基础算法:冒泡,选择,插入和快速排序法
- 没什么可写的就占用点资源吧