Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 763647
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T16:35:46+00:00 2026-05-14T16:35:46+00:00

I am trying to run JUnit test with a 1.5 JRE, but get the

  • 0

I am trying to run JUnit test with a 1.5 JRE, but get the error Message:

java.lang.UnsupportedClassVersionError: Bad version number in .class file

When I switch to JRE 1.6 (actually a JDK but that shouldn’t matter, right?) everythings works fine.

So the questions are:

  • Do we really need Java 6 for the current JUnit version?
  • what is the newest JUnit version, that works with Java 5?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T16:35:46+00:00Added an answer on May 14, 2026 at 4:35 pm

    A spot check of a few classes shows that the JUnit 4.8.2 jar file was compiled with java 5, or with the java 6 compiler with the -target option set so that it makes java5-compatible class files.

    A far more likelier explanation is that you’ve accidentally compiled the test you wanted to run with a Java 6 JDK. What does:

    javap -verbose -classpath YOUR_TOP_DIRECTORY com.yourname.YourTest
    

    say at the top of its output for “major version”? If it says 50, then the problem is that you’ve compiled your test class for java 6 only. You need to either use a JDK 5 compiler or pass the option -target 1.5 to your compiler.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When trying to run a junit test I get the following error - java.lang.ClassCastException:
I'm trying to run some JUnit test units in Eclipse 3.5, but with no
I'm using Hibernate 4.0.1.Final. I'm trying to run a JUnit test on my DAO
I'm trying to run JUnit4 test cases on Eclipse 3.4.2 but it's not even
I'm trying to get JUnit 4 tests to properly run in Eclipse Indigo SR1,
When trying to run test with JMockit on OpenJDK 6, I'm facing the error:
I'm trying to run Junit test from my ant build.xml file. I read here
I'm trying to run Jettys ServletTester in my JUnit test. I created a simple
I'm trying to run JUnit test with JMeter 2.7. However, when selecting the test
I'm trying to run my junit test (to verify that a properties file loads

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.