• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 205
  • Last Modified:

Bad Class File Error

Hi Guys,
I am getting the following error :
An error occurred at line: 7 in the jsp file: /test1.jsp
Generated servlet error:
bad class file: C:\Student\Assignment2\WEB-INF\classes\ie\nci\Accommodation\DBBase.class
class file has wrong version 49.0, should be 48.0
Please remove or make sure it appears in the correct subdirectory of the classpath.
    AccommodationSampleHelper helper = new AccommodationSampleHelper();
                                       ^
1 error

when trying to run the below jsp file code:

%@page contentType="text/html"%>
<%@page import="ie.nci.Accommodation.*"%>
<html>
<head><title>JSP Page</title></head>
<body>
<table>
<%
    AccommodationSampleHelper helper = new AccommodationSampleHelper();
    AccommodationSample[] accommodationSamples = helper.getAllAccommodationSample() ;
   
    for (int i = 0 ; i < accomodationSamples.length ; i ++)
      {
        out.print("<TR>");
        out.print("<TD>" + accomodationSamples[i].getPaymentType() + "</TD>");
        out.print("<TD>" + accomodationSamples[i].getDescription() + "</TD>");
         
    }
%>
</table>
</body>
</html>

Any advice appreciated
0
Barry Cunney
Asked:
Barry Cunney
  • 2
2 Solutions
 
fargoCommented:
may be the JAVA_HOME is pointing to some version which is not compatible with the class file compiled version compiler. Which java version r u using? Make sure the app is pointing to correct java version.
0
 
fargoCommented:
r u using IDE like Eclipse, NetBeans etc....
0
 
hoomanvCommented:
Java 1.4 creates class files labeled with version 48.0
Java 1.5 creates class files labeled with version 49.0

Java 1.4 can't run class files labeled with version 49.0

If you are getting the error, that means that you're trying to run using Java 1.4 - either you're doing it, ir (more likely) your PATH environment variable is set so that Java 1.4 is before 1.5 in the path, and it executes rather than 1.5

Solution: change JAVA_HOME so that 1.5 runs class files labeled 49.0.

0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now