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)

解决方案 »

  1.   

    这是典型的高版本JDK编译后的class文件,放到了低版本的JRE上运行。Unsupported major.minor version 49.0从这句话来看,你应该用的是JDK 1.5 来编译的代码,那么运行环境JRE版本应该是 1.4
      

  2.   


    我是用JDK 1.5 版本 编译的!运行环境 也是 1.5啊!
      

  3.   

    建议你仔细检查下运行环境,最好是能在该环境中,比如批处理中输出下: java  -version
      

  4.   

    如果设置了环境变量,命令行输
    javac -version
    java -version
    看二者版本是否一致。有可能机器装了两个jdk,比如安装了oracle。这时在环进变量中,把你本来的jdk放到最前面。
      

  5.   

    如下:
    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)
      

  6.   

    你是怎么启动这个jar的?直接命令行启动么?
      

  7.   

    看一下eclipse的配置,编译用的jdk,和运行时用的jdk版本是否一致。
    可能是原来那个路径被覆盖了?
      

  8.   

    不是,打包后。
    用.bat 运行 
      

  9.   

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