gpt4 book ai didi

java.lang.UnsupportedClassVersionError : com/mysite/folders/Folders : Unsupported major. 次要版本 51.0

转载 作者:行者123 更新时间:2023-12-01 18:53:24 25 4
gpt4 key购买 nike

我创建了一个名为“Folders”的 java bean(暂时非常简单,因为我想让它主要工作),我将其导出为 .jar 文件并将其放在/WEB-INF 中/lib/目录。但是,当我尝试在预期页面上使用它时,我收到此错误(如果需要,我可以添加长语句的 res):

Feb 22, 2013 12:02:31 PM org.apache.catalina.core.ApplicationDispatcher invoke
SEVERE: Servlet.service() for servlet jsp threw exception
java.lang.UnsupportedClassVersionError: com/mysite/folders/Folders : Unsupported major.minor version 51.0 (unable to load class com.mysite.folders.Folders)

如果可能是导致问题的原因,那么这是 Bean:

package com.mysite.folders;

import java.io.Serializable;
import java.util.ArrayList;

public class Folders implements Serializable {

private String accountNumber;
private String folderName;
private String groupName;
private ArrayList<String> folderNames;
private ArrayList<String> groupNames;

public String getAccountNumber() {
return accountNumber;
}

public void setAccountNumber(String accountNumber) {
this.accountNumber = accountNumber;
}

public String getFolderName() {
return folderName;
}

public void setFolderName(String folderName) {
this.folderName = folderName;
}

public String getGroupName() {
return groupName;
}

public void setGroupName(String groupName) {
this.groupName = groupName;
}

public ArrayList<String> getFolderNames() {
return folderNames;
}

public void setFolderNames(ArrayList<String> folderNames) {
this.folderNames = folderNames;
}

public ArrayList<String> getGroupNames() {
return groupNames;
}

public void setGroupNames(ArrayList<String> groupNames) {
this.groupNames = groupNames;
}

public Folders(String accountNumber, String folderName, String groupName,
ArrayList<String> folderNames, ArrayList<String> groupNames) {
super();
this.accountNumber = accountNumber;
this.folderName = folderName;
this.groupName = groupName;
this.folderNames = folderNames;
this.groupNames = groupNames;
}
}

最后是我在页面上的声明:

<jsp:useBean id="Folders" scope="session" class="com.mysite.folders.Folders" />

我觉得我这样做是正确的,但不确定为什么这不起作用。任何建议或提示将不胜感激。

最佳答案

似乎您正在使用 JDK7 进行编译,并且在您使用它的地方降低版本

查看维基百科代码

正在使用的类文件格式的主版本号。

J2SE 7 = 51 (0x33 hex).

正如所有建议,也请参阅此 How to fix java.lang.UnsupportedClassVersionError: Unsupported major.minor version

关于java.lang.UnsupportedClassVersionError : com/mysite/folders/Folders : Unsupported major. 次要版本 51.0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15030725/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com