HELP! - Exception in thread "main" java.lang.UnsupportedClassVersionError

C

crab.dae

I'm going through the Tutorial on Sun's site and have installed JDK SE
Update 2.

I 1st uninstalled all JAVA from my PC, then did the install, leaving
all settings with the default value of the installer.

After install, I ran into a problem with using JAVAC to compile
HelloWorldApp from the tutorial. That was fixed with a change in the
Enviro Variable to ClassPath set to C:\Program Files\Java
\jdk1.6.0_02\bin

Afterwards, I tried to run it from c:java. From the c:\java
directory, I typed java HelloWorldApp when I get the below error:

==========
C:\JAVA>java helloworldapp
Exception in thread "main" java.lang.UnsupportedClassVersionError:
helloworldapp
(Unsupported major.minor version 50.0)
at java.lang.ClassLoader.defineClass0(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)
==========

I then tried added C:\Program Files\Java\jdk1.6.0_02 to the PATH
Enviroment Variable and I still get the error. I'm thinking it might
be a problem with Oracle. Below is my PATH variable. Should I move C:
\Program Files\Java\jdk1.6.0_02 and/or change it to something else?

C:\Program Files\Oracle\Ora92\bin;
C:\Program Files\Oracle\jre\1.3.1\bin;
C:\Program Files\Oracle\jre\1.1.8\bin;
%SystemRoot%\system32;%SystemRoot%;
%SystemRoot%\System32\Wbem;%SystemRoot%\system32;
%SystemRoot%;%SystemRoot%\System32\Wbem;
C:\Program Files\ATI Technologies\ATI Control Panel;
C:\Program Files\Visual Networks\Dial Analysis\;
C:\Program Files\Microsoft SQL Server\80\Tools\BINN;
C:\Program Files\Common Files\Adaptec Shared\System;
%HummPATH%;C:\sybtools\ASEP;
c:\sqlany50\win32;c:\sybtools\win32;
C:\Program Files\Java\jdk1.6.0_02\

Thanks!!!
 
G

Greg R. Broderick

(e-mail address removed) wrote in @n60g2000hse.googlegroups.com:
I then tried added C:\Program Files\Java\jdk1.6.0_02 to the PATH
Enviroment Variable and I still get the error. I'm thinking it might
be a problem with Oracle. Below is my PATH variable. Should I move C:
\Program Files\Java\jdk1.6.0_02 and/or change it to something else?

Yes :)

I'd recommend removing both of the Oracle JREs from your path, they're the
primary cause of the problem. Oracle's apps will be able to use the
runtime environment that you've installed as part of the JDK 1.6. You also
want to change

C:\Program Files\Java\jdk1.6.0_02

to

C:\Program Files\Java\jdk1.6.0_02\bin


Cheers
GRB

--
---------------------------------------------------------------------
Greg R. Broderick (e-mail address removed)

A. Top posters.
Q. What is the most annoying thing on Usenet?
---------------------------------------------------------------------
 
P

Patricia Shanahan

Greg said:
(e-mail address removed) wrote in @n60g2000hse.googlegroups.com:


Yes :)

I'd recommend removing both of the Oracle JREs from your path, they're the
primary cause of the problem. Oracle's apps will be able to use the
runtime environment that you've installed as part of the JDK 1.6. You also
want to change

C:\Program Files\Java\jdk1.6.0_02

to

C:\Program Files\Java\jdk1.6.0_02\bin

Also, check that you have the right Java version using:

java -version

Patricia
 
C

crab.dae

(e-mail address removed) wrote in @n60g2000hse.googlegroups.com:


Yes :)

I'd recommend removing both of the Oracle JREs from your path, they're the
primary cause of the problem. Oracle's apps will be able to use the
runtime environment that you've installed as part of the JDK 1.6. You also
want to change

C:\Program Files\Java\jdk1.6.0_02

to

C:\Program Files\Java\jdk1.6.0_02\bin

Cheers
GRB

--
---------------------------------------------------------------------
Greg R. Broderick (e-mail address removed)

A. Top posters.
Q. What is the most annoying thing on Usenet?
---------------------------------------------------------------------

Greg,

Removing the Oracle JRE's allowed it to work perfect. Thanks!!
 
C

crab.dae

Also, check that you have the right Java version using:

java -version

Patricia

Patricia,

I should have posted that I had already checked the version... That
was one of the 1st things I did because I knew I had uninstalled all
the JAVA before installing version 1.6.0. It through me for a loop
because I couldn't figure out why there was a version problem.

Thanks!
 
B

bikeriderga

I'm going through the Tutorial on Sun's site and have installed JDK SE
Update 2.

I 1st uninstalled all JAVA from my PC, then did the install, leaving
all settings with the default value of the installer.

After install, I ran into a problem with using JAVAC to compile
HelloWorldApp from the tutorial. That was fixed with a change in the
Enviro Variable to ClassPath set to C:\Program Files\Java
\jdk1.6.0_02\bin

Glad you got it working, but although I know Sun's installers put the
runtime in the Program Files folder, it is always a good idea NOT to
use spaces where java is located.

Also, if you have several Java Versions on your machine (a pain in
Windows because of the registry), creating a batch file to run your
programs will make sure you are using the right version).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top