转载 http://mail-archives.apache.org/mod_mbox/maven-users/200810.mbox/%3C20262610.post@talk.nabble.com%3E
Maven 遭遇java.lang.UnsupportedClassVersionError:.... (Unsupported major.minor
version 49.0)
Hi Thomas,
I had the same issue, when you configure the maven-compiler-plugin with java
1.4 in your POM then m2eclipse automatically sets the 1.4 in the project
build path, but then you have the exception you quote when you try to run
maven commands.
I found several workarounds:
1. Change the project configuration in Eclipse:
- in the Java Build path, set JRE 1.5 or 1.6
- in the Java Compiler configuration, set Compiler compliance level to
1.4
Then you will be able to run maven, and your compiled code will be
compatible with Java 1.4
The drawback is that you will not be able to let m2eclipse update the
configuration (using Maven menu > Update Project Configuration) else you
lose this.
2. Change the Maven configuration in Eclipse to use an external Maven
program instead of the Embedder:
Window > Preferences > Maven > Installations
Because it is the Maven Embedder that is used by default to run Maven
programs and it requires Java 1.5 to work.
3. Use a custom launch configuration for your maven command in Run
Configurations... menu, there you can choose the Maven runtime to use
instead of the Embedder, as explained here:
http://docs.codehaus.org/display/M2ECLIPSE/Launching+Maven
There is a bug open about this issue:
http://jira.codehaus.org/browse/MNGECLIPSE-798
You can vote for it!
Amélie
thomas2004 wrote:
>
> Hi all,
>
> I use Eclipse Ganymede and I start it with Java 6. I've installed the
> maven plugin.
>
> But I configure a project with JRE of Java 1.4.2. As I run any maven
> command such as "mvn clean" or "mvn install", I got exception as follow.
> But as I change the JRE to Java 1.5, it's OK. But I do want to create
> project in Java 1.4. Any idea?
>
> java.lang.UnsupportedClassVersionError:
> org/apache/maven/artifact/resolver/AbstractArtifactResolutionException
> (Unsupported major.minor version 49.0)
> at java.lang.ClassLoader.defineClass0(Native Method)
> at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
> at
> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
> at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
> at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
> at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
> at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
> at
> org.apache.maven.cli.MavenCli.buildEmbedderConfiguration(MavenCli.java:204)
> at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:138)
> at org.apache.maven.cli.MavenCli.main(MavenCli.java:63)
> at org.apache.maven.cli.MavenCli.main(MavenCli.java:52)
> Exception in thread "main"
>
--
View this message in context: http://www.nabble.com/java.lang.UnsupportedClassVersionError%3A....-%28Unsupported-major.minor-version-49.0%29-tp20228678p20262610.html
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
分享到:
相关推荐
### java.lang.UnsupportedClassVersionError问题的解决方法 在开发Java应用程序的过程中,经常会遇到与JDK版本不兼容的问题,其中一种常见的异常就是`java.lang.UnsupportedClassVersionError`。该错误通常发生在...
### java.lang.UnsupportedClassVersionError问题解析与解决方案 在Java开发过程中,经常会在部署或运行时遇到`java.lang.UnsupportedClassVersionError`错误。该错误通常发生在类文件版本与JVM(Java虚拟机)版本...
### java.lang.UnsupportedClassVersionError: Bad version number in .class file 异常的解决办法 #### 一、问题概述 在使用MyEclipse进行Java开发的过程中,可能会遇到`java.lang.UnsupportedClassVersionError:...
java.lang.UnsupportedClassVersionError 是一种不支持的类版本错误,指的是在程序中 Java 虚拟机试图从读取某个类文件,但是发现该文件的主、次版本号不被当前 Java 虚拟机支持的时候,抛出的异常。 33. java.lang...
### Java JDK 安装与Eclipse集成指南 #### 一、前言 本文档旨在指导初学者如何正确安装Java Development Kit (JDK)并配置Eclipse集成开发环境(IDE),以便进行Java应用开发。JDK是Java编程语言的基础工具包,而...
java.lang.UnsupportedClassVersionError: com/util/PostUtil at org.apache.jsp.shouye.index_jsp._jspService(index_jsp.java:84) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) ...
4. **集成开发环境(IDE)**:推荐使用Eclipse或IntelliJ IDEA等Java开发工具,便于代码管理和调试。 接下来是Jeecms的安装步骤: 1. **解压Jeecms源码**:下载并解压`jeecms-3.0.4-final-src.zip`,这将包含整个...
- **`java.lang.UnsupportedClassVersionError`**:当JVM版本不支持类文件版本时抛出。 - **`java.lang.VirtualMachineError`**:当JVM出现严重错误时抛出,如内存损坏。 了解并掌握这些异常及其处理方法对于编写...
6. **java.lang.UnsupportedClassVersionError**: 如果编译的类文件版本高于正在运行的JVM版本,就会出现这个错误。确保JVM与编译器版本兼容。 7. **java.lang.VerifyError**: 验证器在类文件加载期间发现内部不...
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...
描述部分虽然重复了标题内容,但通过“Java编译错误_UnsupportedClassVersionError.txt”这个文件名,我们可以推断出该文档可能是关于如何理解和解决Java环境中的`UnsupportedClassVersionError`问题的一个技术指南...
- **`java.lang.UnsupportedClassVersionError`**:类版本不受支持时抛出。 ### 异常处理策略 针对以上提到的各种异常,合理的异常处理策略非常重要。以下是一些基本的原则: - **预防优先**:尽可能地预防异常的...
mysql-connection-java-5.1.28.jar下载j ava.lang.UnsupportedClassVersionError: com/mysql/jdbc/Driver :-附件资源
apktool1.4.1.tar.bz2 和 apktool-install-windows-r04-brut1.tar.bz2(两个包都下载)反编译apk生成程序的源代码和图片、XML配置、语言资源等文件
当一个APK安装到设备上时,它的Java字节码会被转换为 Dex 文件,以便在设备上运行。 **dextojar** 是一个实用工具,它能够将 Dex 文件转换为 Java 字节码的 JAR 文件。这个过程被称为反编译,因为它将二进制的 Dex ...
PowerDesigner v15.1汉化破解版,可直接覆盖安装目录汉化破解
* java.lang.UnsupportedClassVersionError: Bad version number in .class file + 解决方案:检查 Java 的版本是否正确,是否存在版本不兼容的问题,尝试使用 compatible 的 Java 版本来解决问题。 四、JSP 异常...
java.lang.UnsupportedClassVersionError: org/apache/catalina/authenticator/FormAuthenticator : Unsupported major.minor version 51.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang....
`java.lang.NullPointerException` `NullPointerException`是当程序尝试访问一个为`null`的对象实例的字段、调用其方法或构造函数时抛出的异常。这种异常通常发生在程序员错误地假设某个引用总是指向一个有效的...