java版本号49.0_又是48,49JDK版本不兼容(Unsupported major.minor version 49.0) | 学步园...

非常感谢你的阅读,如果你觉得好或者对你有帮助,请积极给一个留言反馈以示鼓励。

随着JDK版本的升级,尤其是JDK1.4升级到JDK5.0,在Java程序中我们往往会遭遇两种尴尬:

1 Unsupported major.minor version 49.0

2 当前的版本是49.0,需要的是48.0(大概是这个意思)

第一种情况在java应用程序、web应用程序都有遇到

第二种情况我遇到的是表现在web应用程序中

问题分析:

48,49是Java编译器内部的版本号,48表示是用JDK1.4来编译运行程序的,49表示是用JDK编译运行程序的

问题解决:方法一

方式:重新用JDK1.4编译,并在JDK1.4的环境下(包括修改JAVA_HOME,PATH,CLASSPATH,Tomcat使用的JDK)运行;

效果:java应用程序可行;Web应用程序失败。

方法二

方式:采用JDK5.0编译,并在JDK5.0下运行(包括修改JAVA_HOME,PATH,CLASSPATH,Tomcat使用的JDK)

效果:java应用程序可行;Web应用程序可以。

关于方法二的两点特殊补充特殊说明一:

如果采用了方式二,即JDK5.0,要求Tomcat版本必须不能低于5.5*。问题是如果我需要用低于5.5*版本的Tomcat怎么办呢?

答案就是:将JDK5.0的lib目录下的tools.jar覆盖 TOMCAT安装目录/common/lib下面的tools.jar,然后重启TOMCAT5.0就可以了

特殊说明二:

如果你选择的是Eclipse+MyEclipse开发环境,并且你选择的是在Eclipse下启动Tomcat,千万记住,一定要在windows菜单preference选项弹出的perference对话框中,选择MyEclipse--Application Server--Tomcat5---JDK指定JDK为5.0

倒霉的孩子,看过本系列的第一篇之后,你搞定了么?!

估计有许多人依然不能;但是IDE环境中的绝对没有问题;

可是离开IDE(JBuilder、Eclipse+MyEclipse),只在Tomcat下运行依然不行,是不是?!不要问是不是Tomcat5.0系列不支持JDK1.5,我在第一篇中已经告诉你怎么干了,可是为啥还不行呢?!甚至有人安装、卸载了好几次JDK1.4 JDK1.5,可怜啊;抱一起哭吧;我也遇到了这个问题。

在捣鼓了一顿后,总结如下:

只在Tomcat下运行,但是依然出现“Unsupported major.minor version 49.0”,我捣鼓了大概120分钟:

1. java -version 看显示的JDK版本

2. 如果显示版本是1.5,但还是不能运行,则必须验证如下两点:

* 是否按第一篇教给你的格式做了,(没有的话,我则白白总结了,哎)

* 查看注册表,修改注册表HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft下的关于1.4的jre和jvm的路径信息改为1.5的jdk的即可。

估计还是不行。

为啥?因为你安装Tomcat5.0系列时指定了JRE了啊,难道你以为环境变量里修改了就OK了么?

不是这样的。你进入Tomcat5.0的安装目录,bin下是不是有个tomcat5w.exe文件,你打开看看java标签项

看到Java Virtual Machine这个选项是什么了吧? 不是JDK1.5。

还等着干什么?! 修改,然后开始喝香槟庆祝郁闷解除了吧

java反编译工具jad 1.5.8g支持 jdk1.5,jdk1.6。说明很多记住一个万能的命令基本就够用了。jad -sjava -r -8 -o **\*.class ---------------This is README file for Jad - the fast Java Decompiler.Jad home page: http://www.kpdus.com/jad.htmlCopyright 2001 Pavel Kouznetsov (jad@kpdus.com).0. Please read the disclaimer on the Jad home page.1. Installation.Unzip jad.zip file into any appropriate directory on your hard drive.This will create two files: - an executable file named 'jad.exe' (Windows *) or 'jad' (*n*x) - this README fileNo other setup is required.2. How to use JadTo decompile a single JAVA class file 'example1.class' type the following: jad example1.classThis command creates file 'example1.jad' in the current directory.If such file already exists Jad asks whether you want to overwrite it or not.Option -o permits overwriting without a confirmation.You can omit .class extension and/or use wildcards in the names ofinput files.Option -s allows to change output file extension: jad -sjava example1.classThis command creates file 'example1.java'. Be careful when usingoptions -o and -sjava together, because Jad can accidentally overwriteyour own source files.Jad uses JAVA class name as an output file name. For example, if classfile 'example1.class' contains JAVA class 'test1' then Jad will createfile 'test1.jad' rather than 'example1.jad'. If you want to specifyyour own output file name use the output redirection: jad -p example1.class > myexm1.javaOption -d allows you to specify another directory for output files,which are created, by default, in the current directory. For example: jad -o -dtest -sjava *.class (or jad -o -d test -s java *.class, which has the same effect)This command decompiles all .class files in the current directory <
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值