aspose file tools*
The moose likes Java in General and the fly likes UnsupportedClassVersionError, Can the good people help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "UnsupportedClassVersionError, Can the good people help" Watch "UnsupportedClassVersionError, Can the good people help" New topic
Author

UnsupportedClassVersionError, Can the good people help

Key Young
Greenhorn

Joined: Sep 18, 2006
Posts: 19
This is the same qoestion I posted yesterday. Sorry that I have to post it again as a new question because I need help urgently. I have not been able to do anything for the past few days because of this problem.
Can someone with good knowledge help ?

Hi Joy,
Thanks for the reply. I hope you are still awake in Dallas. I just arrived in school here in the morning.
I have define JAVA_HOME=C:\Program Files\Java\jdk1.5.0_08 and PATH=C:\Program Files\Java\jdk1.5.0_08\bin
I have also done exactly what you ask and set the classpath to C:\jdk150_04\lib\tools.jar;C:\jdk150_04\jre\lib\rt.jar. But why set classpath to this value. Can you explain a bit.

I still get this when I do java -version

java version "1.3.1_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_02-b02)
Java HotSpot(TM) Client VM (build 1.3.1_02-b02, mixed mode)

I don't have any version 1.3 in my computer and I don't think 1.3 has ever been installed in this PC because this is a new computer.

I also found out. My friend's computer has only path value for version 1.4, but when I tried java -version on his computer I got version 1.5.

The OS in my PC still see version 1.3 for some reason.
Can someone out there please lend a helping hand because this is really
annoying.

Can this be because I have NetBean and j2ee sdk installed in the same machine ?
Could this be because of virus ? But these computers in the lab are protected by McAfee

Can someone with good knowledge about this thing help ? Can the sun people help. I have not been able to get anything done for 3 days because of this
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2367
If you're getting the Java version 1.3 when you type java -version, then there is something wrong with your PATH variable, or the directory c:\program files\java\jdk1.5.0_08\bin isn't there.

At the command prompt, if you type set, what is reported as the value of PATH?
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6662
    
    5

Type "set" in command prompt to set the proper classpath and path variables. Make sure you dont have a space when defining these variables.

Example:

set classpath=d:\java\JDKHome;d:\java\bin\d:\bla_bla;
set path=d:\java\bin;

Type "set" to confirm that your paths and classpaths are set. The problem is... you are trying to run a class file whose version does not match with that of the JVM.


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
Key Young
Greenhorn

Joined: Sep 18, 2006
Posts: 19
Thanks Keith and John.

I don't think there is anything wrong with my path variable. When I type set I see everything I set in the system properties. However when I type java -version, I still get jdk 1.3 version. The most amazing thing is jdk1.3 was never installed in this computer.And also some computers in the same lab has no path variable=jdk1.5 version and when I type java -version I get jdk 1.5. I originally suspect the NetBean or sjsas installed cause the problem but then every computer in the lab has exactly the same thing installed in it by the same person.

I try John's method by typing set classpath=jdkHOME and path=jdkBIN dir before I run the program. It works OK. I can compile and run the program using jdk 1.5 version and I see jdk 1.5 when I type java -version.

The problem now is I cannot set the path environment variable using the system properties window. I have to type set classpath=jdkHOME and path=jdkBIN everytime I want to run my program.
By the way I am using WinXP professional

This is what I get when I type set. Obviously the path value has C:\Program Files\Java\jdk1.5.0_08\bin

C:\Documents and Settings\user>set
ALLUSERSPROFILE=C:\Documents and Settings\All Users
APPDATA=C:\Documents and Settings\user\Application Data
CATALINA_HOME=C:\apache-tomcat-5.5.17
CLASSPATH=C:\MyProgram;C:\Program Files\Java\jdk1.5.0_08\lib\tools.jar;C:\Progra
m Files\Java\jdk1.5.0_08\jre\lib\rt.jar
CLIENTNAME=Console
CommonProgramFiles=C:\Program Files\Common Files
COMPUTERNAME=LAB401-15
ComSpec=C:\WINDOWS\system32\cmd.exe
FP_NO_HOST_CHECK=NO
HOMEDRIVE=C:
HOMEPATH=\Documents and Settings\user
INCLUDE=C:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\include\
JAVA_HOME=C:\Program Files\Java\jdk1.5.0_08
JSERV=C:\Oracle9i\DB/Apache/Jserv/conf
LIB=C:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\Lib\
LOGONSERVER=\\LAB401-15
NUMBER_OF_PROCESSORS=2
OS=Windows_NT
Path=C:\Perl\bin\;C:\Oracle9i\DS\jdk\jre\bin\classic;C:\Oracle9i\DS\jdk\jre\bin;
C:\Oracle9i\DS\bin;C:\Oracle9i\DS\jlib;C:\Oracle9i\DB\bin;C:\Program Files\Oracl
e\jre\1.3.1\bin;C:\Program Files\Oracle\jre\1.1.8\bin;C:\WINDOWS\system32;C:\WIN
DOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Microsoft SQL Server\80\Tools\BIN
N;C:\Sun\AppServer\bin;C:\Program Files\Java\jdk1.5.0_08\bin
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
PROCESSOR_ARCHITECTURE=x86
PROCESSOR_IDENTIFIER=x86 Family 15 Model 4 Stepping 7, GenuineIntel
PROCESSOR_LEVEL=15
PROCESSOR_REVISION=0407
ProgramFiles=C:\Program Files
PROMPT=$P$G
SESSIONNAME=Console
SystemDrive=C:
SystemRoot=C:\WINDOWS
TEMP=C:\DOCUME~1\user\LOCALS~1\Temp
TMP=C:\DOCUME~1\user\LOCALS~1\Temp
USERDOMAIN=LAB401-15
USERNAME=user
USERPROFILE=C:\Documents and Settings\user
VS71COMNTOOLS=C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Tools\
windir=C:\WINDOWS
WV_GATEWAY_CFG=C:\Oracle9i\DB\Apache\modplsql\cfg\wdbsvr.app

C:\Documents and Settings\user>

Can someone take a look for me what is wrong ?
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
This is not 100% specific to SCJP. Moving to Java In General (Intermediate) where you may find help.


Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
What version of java do you have in C:\Oracle9i\DS\jdk\jre\bin; which is right at the front of your PATH?
Praveen Babu
Ranch Hand

Joined: Jul 30, 2006
Posts: 138
Hi,

By default, Oracle has an embedded jdk in it. If you first installed jdk and then oracle then your jdk in the oracle one will become effective.

Try removing all references to jdk or jre from oracle but you can safely retain the oracle executables path ( ORACLE_HOME\bin directory).

Regards,
Praveen
[ September 20, 2006: Message edited by: Praveen Babu ]
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8997
    
    9

It's right there in the path, clear as day:

As Praveen said, Oracle installs a JRE.


[How To Ask Questions On JavaRanch]
Key Young
Greenhorn

Joined: Sep 18, 2006
Posts: 19
Thanks to Barry, Praveen and Joe. It is Oracle causing the problem.
However, there is still one mystery remains. In some computers of the
same lab I get jdk 1.5 version when I do java -version. But the problem
is that the path variable was never set to JDK 1.5. and I have remove the path to Oracle

This what I get when I do set:

C:\Documents and Settings\user>java -version
java version "1.5.0_05"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_05-b05)
Java HotSpot(TM) Client VM (build 1.5.0_05-b05, mixed mode, sharing)

C:\Documents and Settings\user>set
ALLUSERSPROFILE=C:\Documents and Settings\All Users
APPDATA=C:\Documents and Settings\user\Application Data
CATALINA_HOME=C:\apache-tomcat-5.5.17
CLASSPATH=C:\apache-tomcat-5.5.17\common\lib\servlet-api.jar;C:\apache-tomcat-5.
5.17\common\lib\jsp-api.jar
CLIENTNAME=Console
CommonProgramFiles=C:\Program Files\Common Files
COMPUTERNAME=LAB401-11
ComSpec=C:\WINDOWS\system32\cmd.exe
FP_NO_HOST_CHECK=NO
HOMEDRIVE=C:
HOMEPATH=\Documents and Settings\user
INCLUDE=C:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\include\
J2EE_HOME=C:\Sun\AppServer
JAVA_HOME=C:\j2sdk1.4.2_08
JSERV=C:\Oracle9i\DB/Apache/Jserv/conf
LIB=C:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\Lib\
LOGONSERVER=\\LAB401-11
NUMBER_OF_PROCESSORS=2
OS=Windows_NT
Path=C:\WINDOWS\System32;C:\Sun\AppServer\bin;C:\j2sdk1.4.2_08\bin
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
PROCESSOR_ARCHITECTURE=x86
PROCESSOR_IDENTIFIER=x86 Family 15 Model 4 Stepping 7, GenuineIntel
PROCESSOR_LEVEL=15
PROCESSOR_REVISION=0407
ProgramFiles=C:\Program Files
PROMPT=$P$G
SESSIONNAME=Console
SystemDrive=C:
SystemRoot=C:\WINDOWS
TEMP=C:\DOCUME~1\user\LOCALS~1\Temp
TMP=C:\DOCUME~1\user\LOCALS~1\Temp
USERDOMAIN=LAB401-11
USERNAME=user
USERPROFILE=C:\Documents and Settings\user
VS71COMNTOOLS=C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Tools\
windir=C:\WINDOWS
WV_GATEWAY_CFG=C:\Oracle9i\DB\Apache\modplsql\cfg\wdbsvr.app

C:\Documents and Settings\user>

Can you guys take a look for me.
Praveen Babu
Ranch Hand

Joined: Jul 30, 2006
Posts: 138
This is because your JRE 1.5 is in effect. Try removing JRE 1.5 and retain only JRE 1.4.(remember its JRE not JDK)
Key Young
Greenhorn

Joined: Sep 18, 2006
Posts: 19
Thank you Praveen. How can the JRE is in effect when there is no JRE 1.5 seen in the path above ?
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
Have a close look at what is in "C:\Sun\AppServer\bin" which is on your path.
Is there a java.exe there?
Key Young
Greenhorn

Joined: Sep 18, 2006
Posts: 19
Thanks Barry,

This all I have in the Sun\AppServer\bin but there is no java.exe. What is
java.exe anyway ? Can you take a look ?

C:\Sun\AppServer\bin>dir
Volume in drive C has no label.
Volume Serial Number is 4CB2-07BB

Directory of C:\Sun\AppServer\bin

09/15/2006 04:46 PM <DIR> .
09/15/2006 04:46 PM <DIR> ..
09/14/2006 01:22 PM 458 aku.war.txt
09/14/2006 01:22 PM 233 aku.war.xml
09/06/2006 03:41 PM 2,328 appclient.bat
09/06/2006 03:41 PM 1,146 asadmin.bat
09/06/2006 03:41 PM 3,710 asant.bat
09/06/2006 03:41 PM 1,335 asupgrade.bat
09/15/2006 05:04 PM 2,251 bantai.war.txt
09/15/2006 04:48 PM 1,988 bantai.war.xml
09/11/2006 05:01 PM 1,227 borang.war.txt
09/11/2006 05:01 PM 908 borang.war.xml
09/06/2006 03:41 PM 438 capture-schema.bat
09/06/2006 03:36 PM 26,879 cliutil.dll
09/06/2006 03:41 PM 3,268 deploytool.bat
09/11/2006 04:26 PM 2,483 form.war.txt
09/11/2006 04:26 PM 2,164 form.war.xml
09/11/2006 03:32 PM 2,486 form1.war.txt
09/11/2006 03:32 PM 2,167 form1.war.xml
09/11/2006 04:30 PM 1,230 form3.war.txt
09/11/2006 04:30 PM 911 form3.war.xml
09/15/2006 10:27 AM 458 Hello.war.txt
09/15/2006 10:27 AM 233 Hello.war.xml
09/06/2006 03:41 PM 411 jspc.bat
09/14/2006 12:50 PM 458 lin.war.txt
09/14/2006 12:50 PM 233 lin.war.xml
09/14/2006 04:12 PM 458 linda.war.txt
09/14/2006 04:12 PM 233 linda.war.xml
09/14/2006 12:38 PM 458 linda2.war.txt
09/14/2006 12:38 PM 233 linda2.war.xml
09/14/2006 02:22 PM 458 linz.war.txt
09/14/2006 02:22 PM 233 linz.war.xml
09/12/2006 05:10 PM 458 login.ear.txt
09/12/2006 05:10 PM 233 login.ear.xml
09/06/2006 03:41 PM 528 package-appclient.bat
09/11/2006 04:05 PM 2,495 register.war.txt
09/11/2006 04:05 PM 2,176 register.war.xml
09/11/2006 04:07 PM 4,028 register1.war.txt
09/11/2006 04:07 PM 3,709 register1.war.xml
09/11/2006 05:04 PM 5,204 show1.war.txt
09/11/2006 05:04 PM 5,229 show1.war.xml
09/11/2006 04:13 PM 458 showform.war.txt
09/11/2006 04:13 PM 233 showform.war.xml
09/18/2006 03:48 PM 458 tag.war.txt
09/18/2006 03:48 PM 233 tag.war.xml
09/12/2006 05:06 PM 458 try.ear.txt
09/12/2006 05:05 PM 233 try.ear.xml
09/06/2006 03:41 PM 1,228 verifier.bat
09/06/2006 03:41 PM 1,267 wscompile.bat
09/06/2006 03:41 PM 1,192 wsdeploy.bat
48 File(s) 91,296 bytes
2 Dir(s) 46,374,641,664 bytes free

C:\Sun\AppServer\bin>
Praveen Babu
Ranch Hand

Joined: Jul 30, 2006
Posts: 138
Do a file search for java.exe file on your enitre hard disk ( especially C drive ). If you find multiple results in your search, then change directory to each of these entries and type java -version at the command propmt. If the result is same as the one you are getting, then try removing it. Also check your Control Panel - >Add or remove Programs for multiple JRE entries or in your C:\Program Files\Java\ directory.
 
Consider Paul's rocket mass heater.
 
subject: UnsupportedClassVersionError, Can the good people help