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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T14:17:09+00:00 2026-06-11T14:17:09+00:00

I wanted to test the platform independence of java.So I wrote the hello world

  • 0

I wanted to test the platform independence of java.So I wrote the hello world program in java and compiled it using the compiler for windows to create the HelloWorld.class file. Then I tried to run that file in linux(ubuntu).I ended up in an error.(the JRE was already installed in linux)

Exception in thread "main" java.lang.UnsupportedClassVersionError: HelloWorld : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
at java.net.URLClassLoader.access$000(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:212)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)

Could not find the main class: HelloWorld. Program will exit.

Then I compiled the same program using the linux compiler and used that .class file to check whether it runs in windows.It worked perfectly.

As my knowledge on both occasions the program should have worked perfectly because the byte code file(.class) is platform independent.What has gone wrong when I tried to run the program in linux?

  • 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-11T14:17:10+00:00Added an answer on June 11, 2026 at 2:17 pm
    HelloWorld : Unsupported major.minor version 51.0
    

    Says your compiler version is different from runtime java version.

    My understanding of

    java platform independence

    You need to have JVM which is compatible (same (or) higher) of the class file compiler version on runtime machine also.

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

Sidebar

Related Questions

I am using boost serialization on windows, and I wanted to test my code
Hi I've been writing a chat client and wanted to test the Java Sound
I wanted to write a program that test if two files are duplicates (have
simple example in Notepad++ using RegEx replace search for: anything replace with (wanted): \test
I'm trying to pick up Java and wanted to test around with Java's client/server
I wanted to test Mono AOT, so I wrote a simple console application with
A simple question. Does this version support generators? I wanted to test out using
I wanted to test how C++ behaves when the return value of a function
Out of curiosity I wanted to test the number of ticks to compare a
I set up a new webapp Maven project and wanted to test it with

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.