Bad Class File Error

Posted on 2006-04-22
Last Modified: 2010-04-01
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.*"%>
<head><title>JSP Page</title></head>
    AccommodationSampleHelper helper = new AccommodationSampleHelper();
    AccommodationSample[] accommodationSamples = helper.getAllAccommodationSample() ;
    for (int i = 0 ; i < accomodationSamples.length ; i ++)
        out.print("<TD>" + accomodationSamples[i].getPaymentType() + "</TD>");
        out.print("<TD>" + accomodationSamples[i].getDescription() + "</TD>");

Any advice appreciated
Question by:Barry Cunney
    LVL 11

    Accepted Solution

    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.
    LVL 11

    Expert Comment

    r u using IDE like Eclipse, NetBeans etc....
    LVL 14

    Assisted Solution

    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.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Suggested Solutions

    Title # Comments Views Activity
    ajax auto save 15 89
    problem with  angularjs dropdwon search at object property (name) level 2 83
    Set up Wildfly 10 8 278
    grep code 4 134
    Create and license users in Office 365 in bulk based on a CSV file. A step-by-step guide with PowerShell script examples.
    If you're not part of the solution, you're part of the problem.   Tips on how to secure IoT devices, even the dumbest ones, so they can't be used as part of a DDoS botnet.  Use PRTG Network Monitor as one of the building blocks, to detect unusual…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…

    758 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now