`
henryyang
  • 浏览: 108577 次
  • 性别: Icon_minigender_1
  • 来自: 珠海
文章分类
社区版块
存档分类
最新评论
阅读更多

做项目中,经常有些朋友把SVN中的项目下载到本机中时,打开代码,看到的都是一片红,看到一些基本的系统包都报错了,启动项目就报

java.lang.UnsupportedClassVersionError: Bad version number in .class file ,我想大家一定会遇到这种情况吧,原因应该是编译java时生成的class文件,在运行时用到的JRE和class文件版本不一致造成的

         通过互联网资料把这几种情况做出以下3种

1 如果是一般的java程序:

可以在MyEclipse中修改JRE的路径和版本。在Window->Preferences中,打开如下位置,就可修改JRE:

 

修改完之后,最好重新编译一下,选Project->Clean... 选项,然后选择是所有的项目都要重新编译,还是只重新编译指定的项目,然后就应该没问题了。

2 如果是Web 程序

就要修改Tomcat运行时的JDK环境了,如下图:

把JDK的路径和之前Installed JRE的设置成一样的,这个问题就解决了!(虽然这里面设置的是JDK的路径,但是我觉得其实就是在设置JRE的路径,因为java程序运行的时候需要的 是JRE,而不是JDK。我们装JDK的时候,一般都装了2个JRE,一个是JDK里面的JRE,还有一个和JDK平级的JRE,刚才我上网查了一下,这 两个JRE的区别不大,大家也可以去查一下,每次都可以选择任何一个JRE,但是之后配置的吆喝前面的一致。)

如果不清楚JDK和JRE的关系的,可以上网查一下。

3我们运行别人的程序可能会遇到这个问题。

这个项目编译并没有报错,如果我们导入别人的项目之后,出现了很多错误,那就是JDK版本的问题了

分享到:
评论

相关推荐

    tomcat:bad version number in class file的解决方法

    tomcat:bad version number in class file的解决方法

    java.lang.UnsupportedClassVersionError Bad version number in .class file异常的解决办法

    在MyEclipse中运行一个小应用程序或者在编辑一些程序时,出现java.lang.UnsupportedClassVersionError Bad version number in .class file异常,的解决办法!

    Bad version number in .class file 错误

    NULL 博文链接:https://happypigs.iteye.com/blog/675096

    Flash Builder 4 正式版中 解决使用LCDS ES2 Data/Services 出现 Bad version number in .class file 问题

    这两天遇到了一个问题,原来使用的是FB 4 Bata 2中没有遇到的问题,在FB 4中遇到了,就是在使用Data/Services...Bad version number in .class file 问题,现在知道怎样一回事了,希望能帮更多人解决这方面的困扰。

    AXMLPrinter2、baksmali、smali、dex2jar

    Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass...

    scraper-one:第一个仅使用 Java 的刮刀项目

    我花了一整天来解决这个问题:( jdk 1.7.0_51 上的 UTC+3 不正确使用 bash 运行 scraper-1.0-SNAPSHOT.jar 时遇到 java.lang.UnsupportedClassVersionError: Bad version number in .class file。 在 Windows 上使用...

    Java 免费给手机发飞信

    一 java.lang.UnsupportedClassVersionError: Bad version number in .class file 必须使用jdk 1.6 二 Exception in thread "main" java.lang.RuntimeException: Your license has expired. Please registe ...,...

    servlet2.4doc

    Overview Package Class Tree Deprecated Index Help PREV NEXT FRAMES NO FRAMES A B C D E F G H I J L P R S U V -------------------------------------------------------------------------------- A ...

    JBOSS5+JDK6+myeclipse8.6搭建EJB3环境-已成功

    1.安装JDK1.6并配置环境变量 2.下载JBOSS,将下载的安装包直接解压到安装...注意:当我安装JDK1.5+JBOSSjboss-5.1.0.GA组合时,报版本冲突错误(Bad version number in .class file错误),我换成JDK1.6就不报错误了。

    BobBuilder_app

    In this version I have done away with the b+tree and hash index in favor of my own MGIndex structure which for all intents and purposes is superior and the performance numbers speak for themselves....

    微软内部资料-SQL性能优化2

    A hard page fault results in a read from disk, either a page file or memory-mapped file. A soft page fault is resolved from one of the modified, standby, free or zero page transition lists. Paging is...

    Bochs - The cross platform IA-32 (x86) emulator

    class, optional commit support on Bochs exit, save/restore file attributes, 1.44 MB floppy support, set file modification date/time - converted the complete hdimage stuff to the new 'hdimage' ...

    Rad Studio Delphi C++builder XE 10.4 Patch2

    This patch addresses a number of issues in RAD Studio 10.4, pertaining to Delphi Compiler, the RAD Studio IDE in general and the new LSP-based Code Insight in particular, plus C++ Builder Android ...

    php.ini-development

    development version only in development environments as errors shown to ; application users can inadvertently leak otherwise secure information. ; This is php.ini-development INI file. ;;;;;;;;;;;;...

    Delphi7.1 Update

    including previously installed release notes.Borland recommends that you read this file in its entirety.NOTE: If you are updating a localized version of Delphi 7, visit the Borland Registered User ...

    一个跨平台的CString源码

    // 2001-APR-27 - StreamLoad was calculating the number of BYTES in one // case, not characters. Thanks to Pablo Presedo for this. // // 2001-FEB-23 - Replace() had a bug which caused infinite ...

    Sakemail

    Minor bugs fixed (some variants of boundary)14/10/971.1.0- Warning: WSockets1.2 have some bugs that result in bad attachments. So I decided to use the sockets of Delphi 3 founded in D3 c/s D3.01 pro ...

    微软内部资料-SQL性能优化3

    If the class is not confident in their understanding, review appendix A04_Locking and its accompanying PowerPoint® file. Transactions in SQL Server provide the ACID properties: Atomicity A ...

    xplite_trial

    We currently distribute both an XPlite and 2000lite program as there are some advanced features coming in a future version that require we split them. XPlite/2000lite Professional is entirely self-...

Global site tag (gtag.js) - Google Analytics