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 9107165
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T02:30:29+00:00 2026-06-17T02:30:29+00:00

Possible Duplicate: Java error: Bad version number in .class file error when trying to

  • 0

Possible Duplicate:
Java error: Bad version number in .class file error when trying to run Cassandra on OS X

I am not sure i am doing anything wrong with this basic hello world program. Have no idea why does this throw errors.

I have saved the file as test.java.

public class test {
    public static void main(String[] args) {
        System.out.println("Hello!");
    }

    /*public static void sop(String str) {
        System.out.println(str);
    }*/
}

When i compile it with javac test.java, it compiles successfully, but when i try to run it by using java test, it gives the following error:

C:\Users\admin\Desktop>java test
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(Unknown Source)
        at java.security.SecureClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.access$100(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClassInternal(Unknown Source)

The Java bin directory is added in System path. Would appreciate any pointers.

Java directories in the system path are as follows:

C:\Program Files\Java\jdk1.6.0_31\bin;C:\Program Files\Java\jre6\lib;

The java/javac versions:

C:\Users\admin\Desktop>java -version
java version "1.5.0_12"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_12-b04)
Java HotSpot(TM) Client VM (build 1.5.0_12-b04, mixed mode, sharing)

C:\Users\admin\Desktop>javac -version
javac 1.6.0_31

Thanks.

  • 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-06-17T02:30:30+00:00Added an answer on June 17, 2026 at 2:30 am

    Your java compiler is version 1.6.0 and your java executable environment is version 1.5.0.

    The error is to tell you that your java executable to too new for the java executable environment.

    To solve your problem you need to update your java environment (or downgrade your java compiler).

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

Sidebar

Related Questions

Possible Duplicate: Java Stacktrace error Unsupported major.minor version 51.0 I am using eclipse, and
Possible Duplicate: setOnClickListener not working and throwing error I am trying to develop a
Possible Duplicate: Java: Always override equals? should I override equals function for any class
Possible Duplicate: Java float division precision I'm trying to fix a bug in one
Possible Duplicate: ant error JAVA_HOME does not point to SDK I'm getting the following
Possible Duplicate: Java += operator In Java, this is not valid (doesn't compile), as
Possible Duplicate: Java: Instanceof and Generics I am trying to write a function which
Possible Duplicate: Unchecked exceptions in Java: Inherit from Error or RuntimeException? Looking at how
Possible Duplicate: Java how to: Generic Array creation Error generic array creation I have
Possible Duplicate: Flex RegExp to Java RegExp I don't know why is it not

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.