Exception in thread "main" java.lang.UnsupportedClassVersionError: HelloWo

Ive followed the First cup of java Tutorial exactly, double and triple checking, and it works up until i run the app with

java HellWorldApp

this is the exact message

Exception in thread "main" java.lang.UnsupportedClassVersionError: HelloWorldApp

(Unsupported major.minor version 49.0)'

then a bunch of java.lang, java.net,ect, lines come up

i have J2SE SDk 1.4.0_2_2005Q2windows

[425 byte] By [andyman3a] at [2007-10-1 20:30:18]
# 1

The class file you're trying to run was compiled by one of the Java 5 versions. (Java 5 creates class files with an internal id of 49.) The 1.4.0 JVM doesn't know how to read/use/run the more recent Java 5 (1.5) version file.

How did this happen? either someone gave you a Java 5 class file, or you have multiple Java versions installed in your machine.

Make sure that the JVM you use for execution is at least as new as the version of javac that was use for compilation.

ChuckBinga at 2007-7-13 2:29:46 > top of Java-index,Administration Tools,Sun Connection...
# 2
You'd have thought that a thousand answers to this question in the past few months would have been enough to let people find the answer for themselves...
jwentinga at 2007-7-13 2:29:46 > top of Java-index,Administration Tools,Sun Connection...
# 3
Thanks, yep, i had an older version of java. I knew it was there i figured it would automatically use my new sdk JVM, but i guess not, but when i deleted the old on it worked
andyman3a at 2007-7-13 2:29:46 > top of Java-index,Administration Tools,Sun Connection...
# 4
I am facing this problem too but i tried deleting the older jdk1.4 and reinstalled jdk1.5. However, this problem still exists. Can you help me?
ah_neo82a at 2007-7-13 2:29:46 > top of Java-index,Administration Tools,Sun Connection...
# 5
Did you try java -version to see if the java on path really is the one you're expecting? There's also the nice a tool that comes with Gentoo ebuilds to select active jvm and set env accordingly.java-config -Ljava-config -S *jdk*
Spoolera at 2007-7-13 2:29:46 > top of Java-index,Administration Tools,Sun Connection...
# 6
Hi, I have installed the verison 1.5 in my PC, but I am, getting the same error. When i checked the version, it says 1.3.x. thats being used by Oracle client and I cannot uninstall that. What to do to get rid of this error?
HemaSivarama at 2007-7-13 2:29:46 > top of Java-index,Administration Tools,Sun Connection...
# 7

> Hi, I have installed the verison 1.5 in my PC, but I

> am, getting the same error. When i checked the

> version, it says 1.3.x. thats being used by Oracle

> client and I cannot uninstall that. What to do to get

> rid of this error?

Change the order of the directories in your computer's Path environmental variable so that the directory with the 1.5 version is the first directory in the list.

Or, use the full path whenever you invoke java or javac, like "c:\j2sdk1.5.0_06\bin\java YourClass"

atmguya at 2007-7-13 2:29:46 > top of Java-index,Administration Tools,Sun Connection...
# 8
thanx guys.i faced the problem and ur soln worked fo me.
anilwanteda at 2007-7-13 2:29:46 > top of Java-index,Administration Tools,Sun Connection...
# 9

I have installed jdk1.5 update version and also jre. Then I've set the class variable. I tried to test a simple program , the compilation has done. When executing it, the error massage comes as:

Exception in thread "main" java.lang.UnsupportedClassVersionError: test(Unsupported major.minor version 49.0)

zapataa at 2007-7-13 2:29:46 > top of Java-index,Administration Tools,Sun Connection...
# 10
Hey me also getting same error..have u got Solution?
man_isha at 2007-7-13 2:29:46 > top of Java-index,Administration Tools,Sun Connection...
# 11
> Hey me also getting same error..have u got Solution?Read the first reply.
aniseeda at 2007-7-13 2:29:46 > top of Java-index,Administration Tools,Sun Connection...
# 12
Hey i have installed jdk1.5 and i set path in environment variable as "C:\Program File\java\jdk1.5\bin", but still i am getting same error, there is no other version running expect JDK1.5, please do help me. --Thanks
man_isha at 2007-7-13 2:29:46 > top of Java-index,Administration Tools,Sun Connection...
# 13

Ok this is your problem you have added Java to the bin only so probably you are using a wrong JRE version

Check JAVA_HOME variable in your environmental variables, if it is not set, set it to the directory in which Java is installed on elevel above bin e.g.:

C:\JDK142_05 and NOT C:\JDK142_05\bin

navdeep.mahajana at 2007-7-13 2:29:46 > top of Java-index,Administration Tools,Sun Connection...
# 14
Hi i am also getting the same problem.i have used jdk1.5.my operating system is windows xp
vijaya_488@rediffmail.coma at 2007-7-13 2:29:46 > top of Java-index,Administration Tools,Sun Connection...
# 15

> Hi i am also getting the same problem.i have used

> jdk1.5.my operating system is windows xp

and what's the problem? Are you incapable of reading a few lines up the page where the solution to your "problem" is presented (as you do seem to have found the search function or you'd not have discovered a thread that's years old)?

jwentinga at 2007-7-20 11:15:42 > top of Java-index,Administration Tools,Sun Connection...
# 16

Well his problem is probably that he's using Windows. :)

Stick with me, I'll explain. I have the same setup (jdk 5 on WinXP) and I came across this thread when searching on the same problem. After cleaning up my environment variables java -version was still resolving as version 1.3.1.

I did a little more digging and found that my command prompt was still looking at C:\winnt\system32 for for java.exe, apparently order does matter for PATH. So I opened up my environment variables again and moved %JAVA_HOME%\bin in front of %SystemRoot%\system32. Restarted my console, ran java -version again and it resolved as version 1.5.0.

I don't know if when you install the JDK that it's supposed to over write the version is system32, because this is my work machine and was preconfigured (long story with many headaches). But this was the case for me and YMMV.

jd.martina at 2007-7-20 11:15:42 > top of Java-index,Administration Tools,Sun Connection...
# 17
i also got same problem.in my sys there was jdk5 & jdkk6 was instlled.so i uninstall one .the problem gets solved.
tushu_hearthackera at 2007-7-20 11:15:42 > top of Java-index,Administration Tools,Sun Connection...
# 18
Wow... I am so glad I came across this thread. Thank you all for your comments. I was having the same problem and I was able to fix it with your help.
Webdevaa at 2007-7-20 11:15:42 > top of Java-index,Administration Tools,Sun Connection...
# 19
I m also facing the same problem. plz help.
Sun_123@abca at 2007-7-20 11:15:42 > top of Java-index,Administration Tools,Sun Connection...
# 20
Check your Installed JRE in the Windows Registry at HKEY_CURRENT_USER\Software\JavaSoft\Java Runtime Environment
flyKitea at 2007-7-20 11:15:42 > top of Java-index,Administration Tools,Sun Connection...