紧急求助 Exception in thread "main" java.lang.UnsupportedClassVersionError:问题

快跑蜗牛哥 2012-07-16 09:41:05
eclipse 打包成jar 文件,
是批量发送邮件的,前几天都能正常运行,
现在只改动一下内容,重新打包 竟然出错!

网上说是版本原因,但最近没有安装jdk啊!
求助!!
出错信息如下:
Exception in thread "main" java.lang.UnsupportedClassVersionError: send_NO/Sender (Unsupported major.minor version 49.0)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:502)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:250)
at java.net.URLClassLoader.access$100(URLClassLoader.java:54)
at java.net.URLClassLoader$1.run(URLClassLoader.java:193)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:186)
at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265)
at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
...全文
8900 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
藩篱 2015-03-21
  • 打赏
  • 举报
回复
请问楼主是怎么解决的,我也遇到了同样的问题,现在还没有解决呢
brightyq 2012-07-16
  • 打赏
  • 举报
回复
如果设置了环境变量,命令行输
javac -version
java -version
看二者版本是否一致。

有可能机器装了两个jdk,比如安装了oracle。这时在环进变量中,把你本来的jdk放到最前面。
MiceRice 2012-07-16
  • 打赏
  • 举报
回复
建议你仔细检查下运行环境,最好是能在该环境中,比如批处理中输出下: java -version
快跑蜗牛哥 2012-07-16
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 的回复:]
这是典型的高版本JDK编译后的class文件,放到了低版本的JRE上运行。

Unsupported major.minor version 49.0

从这句话来看,你应该用的是JDK 1.5 来编译的代码,那么运行环境JRE版本应该是 1.4
[/Quote]

我是用JDK 1.5 版本 编译的!

运行环境 也是 1.5啊!
MiceRice 2012-07-16
  • 打赏
  • 举报
回复
这是典型的高版本JDK编译后的class文件,放到了低版本的JRE上运行。

Unsupported major.minor version 49.0

从这句话来看,你应该用的是JDK 1.5 来编译的代码,那么运行环境JRE版本应该是 1.4
maple_ben 2012-07-16
  • 打赏
  • 举报
回复
当前版本不支持~~~
快跑蜗牛哥 2012-07-16
  • 打赏
  • 举报
回复


不好意思,本来 35分给 brightyq 的,结贴的时候不知咋搞的!!

快跑蜗牛哥 2012-07-16
  • 打赏
  • 举报
回复
知道原因了!!感谢 两位的回复!!


是我偷懒了,配置文件的问题!!

结贴!!
快跑蜗牛哥 2012-07-16
  • 打赏
  • 举报
回复
[Quote=引用 6 楼 的回复:]
你是怎么启动这个jar的?直接命令行启动么?
[/Quote]
不是,打包后。
用.bat 运行
brightyq 2012-07-16
  • 打赏
  • 举报
回复
看一下eclipse的配置,编译用的jdk,和运行时用的jdk版本是否一致。
可能是原来那个路径被覆盖了?
MiceRice 2012-07-16
  • 打赏
  • 举报
回复
你是怎么启动这个jar的?直接命令行启动么?
快跑蜗牛哥 2012-07-16
  • 打赏
  • 举报
回复
如下:


C:\Documents and Settings\hunter>javac -version
javac 1.5.0_06
javac: no source files
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 u
sed
-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



C:\Documents and Settings\hunter>java -version
java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode, sharing)




81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧